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.
The first line contains the number of operations n (1≤n≤105). In the next n 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 105.
Print all removed numbers one per line.