Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- stack = []
- for i in range(n):
- number = input().split()
- if int(number[0]) == 1:
- x = int(number[1])
- stack.append(x)
- elif int(number[0]) == 2:
- if len(stack) > 0:
- stack.pop()
- elif int(number[0]) == 3:
- print(max(stack))
- elif int(number[0]) == 4:
- print(min(stack))
- my_list = []
- while stack:
- my_list.append(stack.pop())
- print(", ".join(map(str, my_list)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement