Implement a stack
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
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 . 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 .
Output
Print all removed numbers one per line.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 6K
Acceptance rate 63%