def main():
n=int(input())
stack=[]
for _ in range(n):
line=input().split()
command=line[0]
if command=="push":
x=int(line[1])
stack.append(x)
elif command=="pop":
if not stack:#if stack==[]
print("Empty")
else:
stack.pop()
elif command=="query":
if not stack:
print("Empty")
else:
print(stack[-1])
elif command=="size":
print(len(stack))
main()

京公网安备 11010502036488号