Giving a queue and 2 kinds of operations: "E x" means add x to the rear of the queue, "D x" means pop the front x elements of the queue.

Submit: 515 Solved: 275

[Submit][Status][Web Board]

Giving a queue and 2 kinds of operations: "E x" means add x to the rear of the queue, "D x" means pop the front x elements of the queue.

The first line contains an integer \(n (1\leq n\leq 10^5)\). Each of the following n lines is an operation:E x or D x. We guarantee operation D does not empty the queue.

Output the front element in queue **in a single line** for each "D" operation

```
6
E 1
E 2
E 3
D 2
E 1
D 1
```

```
3
1
```