#26307: 腦殘作法


joey13130905@gmail.com (笨呆瓜)


#include <iostream> 

#include <queue> 

using namespace std;

 

int main(){

ios_base::sync_with_stdio(0);

cin.tie(0);

int n,k,s;

queue<int>q;

while(cin>>n){

while(n--){

cin>>k;

if(k==1){

cin>>s;

q.push(s);

}

if(k==2){

if(!q.empty())

cout<<q.front()<<"\n";

else

cout<<-1<<"\n";

}  

if(k==3){

if(q.empty())

continue;

q.pop();

}

}

return 0;