Skip to content
UPEEC

Min Stack

Medium#stack#design· solved by 0 · time limit 2.0 s

Process qq operations on a stack: push x, pop (ignored if empty) and min — print the current minimum, or EMPTY. Each operation must be O(1)O(1).

Input

qq, then qq operations, one per line.

Output

One line for every min operation.

Constraints

1≤q≤1051 \le q \le 10^5

Sample 1

Input

6
push 5
push 2
min
pop
min
pop

Output

2
5

Sign in or join free to run and submit your solution.