res, n = [], int(input())
for i in range(n):
ope = input().split(' ')
if ope[0] == 'push':
res.append(ope[1])
elif ope[0] == 'size':
print(len(res))
elif len(res) != 0 and ope[0] == 'pop':
res.pop()
elif len(res) != 0 and ope[0] == 'query':
print(res[-1])
else:
print('Empty')



京公网安备 11010502036488号