LogiQuest

192. Stack Operations

EasyStack

Process commands on an empty stack: push x, pop (print the removed value, or EMPTY), top (print the top value, or EMPTY) and size (print the size).

Input format

Line 1: q Next q lines: commands

Output format

One line per pop, top or size command.

Example 1

Input

6
push 3
push 5
top
pop
pop
pop

Output

5
5
3
EMPTY

Example 2

Input

3
size
push 1
size

Output

0
1

Constraints

1 ≤ q ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.

Loading the MyLoginn IDE…