LogiQuest

194. Min Stack

MediumStackDesign

Support push x, pop and min (print the minimum element in the stack, or EMPTY) — each in O(1). pop on an empty stack does nothing.

Input format

Line 1: q Next q lines: commands

Output format

One line per min command.

Example 1

Input

7
push 5
push 3
min
push 7
min
pop
min

Output

3
3
3

Example 2

Input

4
min
push 2
push 2
min

Output

EMPTY
2

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…