The operations contains:

1. E x Enqueue x .

2. D Dequeue

3. A Print the head of the queue.

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

Submit: 679 Solved: 239

[Submit][Status][Web Board]

IceRuler likes Queues. So he 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 elements in the queue after all operations.

The operations contains:

1. E x Enqueue x .

2. D Dequeue

3. A Print the head of the queue.

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

There is only one testcase. The first line is integer n, the number of operations. (1 <= n <= 20000000) Then n lines for these operations, x in int range.

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.

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

```
1
2
2 3 1
```