Page not loading? Try clicking here.
Placeholder

#1697

Queue 1s 32MB

Problems

A queue is a data structure where the first data to enter is also the first to be removed.

This structure is known as FIFO (First In, First Out).

Queues are very common in daily life. A typical example is standing in line.

  • When waiting at a bank counter or for a bus, the person who arrives first is served first. (Do not consider cutting in line.)

Design a queue as described and perform operations according to the following conditions.


Operations

The commands given are as follows:

  1. "i a" — Insert the number a into the queue. Here, a is a natural number less than or equal to 10,000.

  2. "o" — Remove and output the first element from the queue. If the queue is empty, output "empty".

  3. "c" — Output the number of elements currently in the queue.


Input

  • The first line contains N, the number of commands. (1 ≤ N ≤ 100)

  • The following N lines each contain one command, either "i a", "o", or "c".


Output

  • For each command that produces output, print the result on a separate line.

  • There is always at least one output.


Example

7

i 7
i 5
c
o
o
o
c
2

7
5
empty
0


Source

JUNGOL

You must sign in to write code.