In embedded systems where dynamic memory is not available, stacks are typically implemented using static arrays and index tracking.
Your task is to:
Example Input Format
First line: n (number of operations)
Next n lines: push x or pop
Example-1
Input:
5
push 10
push 20
pop
pop
pop
Output:
20
10
Stack Underflow
Example-2
Input:
4
pop
push 5
pop
pop
Output:
Stack Underflow
5
Stack Underflow
Input
5 push 10 push 20 pop pop pop
Expected Output
20 10 Stack Underflow