#C8900. Warehouse Stock Manager

    ID: 52934 Type: Default 1000ms 256MiB

Warehouse Stock Manager

Warehouse Stock Manager

You are given a series of operations to simulate stock management in a warehouse. There are two types of operations:

  • ship ITEM_CODE QUANTITY: Increases the stock of the specified item.
  • order ITEM_CODE QUANTITY: Attempts to fulfill an order by decreasing the stock. An order is fulfilled if and only if the current stock for the item is at least the required quantity.

For each order operation, output a message in one of the following formats:

  • If fulfilled: Order ITEM_CODE fulfilled
  • If rejected: Order ITEM_CODE rejected

The decision for an order can be mathematically represented as:

\( \text{if } stock[ITEM_CODE] \ge Q \text{ then order is fulfilled, otherwise it is rejected}\)

Process the operations in the given order. Only order operations produce output.

inputFormat

The first line contains an integer n (\(1 \le n \le 10^5\)), the number of operations.

Each of the following n lines contains an operation in one of the two formats:

  • ship ITEM_CODE QUANTITY
  • order ITEM_CODE QUANTITY

outputFormat

For each order operation in the input, output a single line:

  • If the order is fulfilled, output: Order ITEM_CODE fulfilled
  • If the order is rejected, output: Order ITEM_CODE rejected
## sample
6
ship 101 50
ship 202 30
order 101 20
order 202 40
order 101 60
ship 101 30
Order 101 fulfilled

Order 202 rejected Order 101 rejected

</p>