n = int(input())
stk = []
for _ in range(n):
s = list(input().split())
if s[0] == "push":
stk.append(int(s[1]))
elif s[0] == "pop":
if len(stk) > 0:
stk.pop()
else:
print("Empty")
elif s[0] == "query":
if len(stk) > 0:
print(stk[-1])
else:
print("Empty")
elif s[0] == "size":
print(len(stk))

京公网安备 11010502036488号