Submit | All submissions | Best solutions | Back to list |
STACKEZ - Easy Stack |
You have an empty stack and you are given some queries. These queries are the basic stack operations such as Push, Pop, and printing the Top element. Now, you should process the given queries.
Input
First line contains an integer T (0 <= T <= 106).
Each of the next T lines contains a query based on these formats.
1 n : Push n (0 < n <= 109) to the top of the stack.
2 : Pop an element from the top of the stack. If the stack is empty, do nothing.
3 : Print the top element of the stack (see Output Format).
Output
For each query 3, print the top element of the stack. If the stack is empty, print 'Empty!' without quotes.
Example
Input: 6
1 15
1 20
2
3
2
3 Output: 15
Empty!
Warning!
Enormous input data!
Added by: | Lucas |
Date: | 2017-02-15 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |