a=open("input.txt","r")
b=open('output.txt','w')
S=[]
t = 0
while True and t==0:
s=a.readline().strip()
if not s:
break
if s[0]=='+':
S.append(int(s[1:]))
if s[0]=='-':
if len(S)==0:
b.write('ERROR')
t = 1
else:
S.pop()
if t == 0:
if len(S)==0:
b.write('EMPTY')
else:
for i in range (len(S)):
b.write(str(S[i]))
b.write(' ')
a.close()
b.close()