import sys
class quese:
def __init__(self):
self.list=[]
def push(self,x):
self.list.append(x)
def pop(self):
x=self.list.pop(0)
return x
def front(self):
return self.list[0]
def size(self):
return len(self.list)
quese1=quese()
message=input()
messagesplit=message.split()
n=int(messagesplit[0])
q=int(messagesplit[1])
while q>0:
str=input()
if str[0:4]=='push':
if quese1.size()==n:
print('full')
else:
quese1.push(int(str[5:]))
elif str[0:3]=='pop':
if quese1.size()==0:
print('empty')
else:
print(quese1.pop())
else:
if quese1.size()==0:
print('empty')
else:
print(quese1.front())
q-=1