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

京公网安备 11010502036488号