#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n,q[N],head,top;
void push(int x){
    if((top+1)%(n+1)==head) cout<<"full\n";
    else{  
        q[top] = x;
        top = (top+1) %(n+1);
    }
}
void front(){
    if(head==top) cout<<"empty\n";
    else cout<<q[head]<<"\n";
}
void pop(){
    if(head==top) cout<<"empty\n";
    else{
        cout<<q[head]<<"\n";
        head = (head+1) %(n+1);
    }
}
int main(){
    int t;
    cin>>n>>t;
    while(t--){
        string op;cin>>op;
        if("push"==op){
            int x;cin>>x;
            push(x);
        }   
        else if("front"==op){
            front();
        }
        else{
            pop();
        }
//        cout<<head<<" "<<top<<"\n";
    }
    return 0;
}
#牛客春招刷题训练营#https://www.nowcoder.com/discuss/727521113110073344

京公网安备 11010502036488号