Problem B: [Easy II] Skylar Learning Queue

Problem B: [Easy II] Skylar Learning Queue

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 839  Solved: 248
[Submit][Status][Web Board]

Description

Skylar is learning Queues. So she gives you an empty queue initially and some operations on this queue.

The operations contains:

1. E x           Enqueue x

2. D             Dequeue

3. A             Print the head of the queue.

Finally, You should output all the elements in the queue after all operations.

Input

There is only one test case. The first line is integer \(n (1 \leq n \leq 20000000) \), the number of operations.  Then \(n\) lines for these operations, \(x\) in int range.

Output

Do each operation, if it is type 'A', print current queue head in one line. After doing all operations, output the final queue elements in one line, if the queue is empty, print nothing. It is guaranteed that all operations are legal.

Sample Input

7
E 1
E 2
E 3
A
D
E 1
A

Sample Output

1
2   
2 3 1

HINT

[Submit][Status]