LearnPy Hub
← Arena
IntermediateRating 1300

Queue From Two Stacks

Implement a queue using two stacks. Commands: enq x, deq (print the removed value or EMPTY) and peek (print the front or EMPTY).

Input

n, then n commands.

Output

Answers.

Sample 1

Input
5
enq 1
enq 2
peek
deq
deq
Output
1
1
2

Sample 2

Input
1
deq
Output
EMPTY
solution.py
Output appears here
Queue From Two Stacks · Python Arena problem · LearnPy Hub