Implement a stack#5087

Implement a stack

2 seconds
128 megabytes
Very easy

Mary just learned about a new, fashionable structure. It includes "push" and "pop" operations.

Implement a stack with two operations. The “first” operation pushes a number onto the stack, and the “second” operation removes an element from the top of the stack. For each “second” operation, print the removed number. It is guaranteed that all operations are correct.

Input

The first line contains the number of operations n~(1 \le n \le 10^5). In the next lines the first number is the operation number, and the second (only for the "first" operation) is the number to be added. This number is a positive integer and does not exceed 10^5.

Output

Print all removed numbers one per line.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading