Design a stack that also reports its smallest stored value at any moment.
You will process a stream of commands, one per line. Support three commands:
PUSH x— push the integerxonto the top of the stack. Produces no output.POP— remove the top element. PrintOKif an element was removed, orEMPTYif the stack was already empty.MIN— print the smallest value currently on the stack, orEMPTYif the stack is empty.
Output one line for every POP and MIN command, in the order the commands arrive.
Input format
Line 1: an integer q, the number of commands.
Each of the next q lines is one command: PUSH x, POP, or MIN.
Output format
For each POP command, print OK or EMPTY.
For each MIN command, print the current minimum, or EMPTY.
Print the results in command order, one per line.
Constraints
- 1 ≤ q ≤ 100000
- -1000000000 ≤ x ≤ 1000000000
- Every command is exactly one of the three forms above.