#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
queue<int> a;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(s=="push")
{
int x;
cin>>x;
a.push(x);
}
else if(s=="pop")
{
if(a.empty())
cout<<"error\n";
else
{
cout<<a.front()<<"\n";
a.pop();
}
}
else
{
if(a.empty())
cout<<"error\n";
else
cout<<a.front()<<"\n";
}
}
return 0;
}

京公网安备 11010502036488号