Problem Description

Read n commands: PUSH x, POP, TOP. Use functions do_push, do_pop, do_top on a stack and output TOP outputs (or EMPTY).

Input Format

First line n. Next n lines commands.

Output Format

Outputs for TOP.

Sample Test Case

Input:
7 PUSH 5 TOP PUSH 3 TOP POP TOP POP
Output:
5 3 5

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next