import java.util.Scanner;
class MyQueue{
private int size;
private int t1=0, t2=0;
private int[] q;
public MyQueue(int s){
this.size = s;
this.q = new int[s];
}
public void push(int x){
if(this.t2 == this.size-1){
System.out.println("error");
} else {
this.q[t2++] = x;
}
}
public void pop(){
if(t1>=t2) System.out.println("error");
else {
System.out.println(this.q[t1++]);
}
}
public void front(){
if(t1>=t2) System.out.println("error");
else {
System.out.println(this.q[t1]);
}
}
}
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int s = Integer.parseInt(in.nextLine());
MyQueue q = new MyQueue(s);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
String[] arr = in.nextLine().split(" ");
switch(arr[0]){
case "push": q.push(Integer.parseInt(arr[1]));break;
case "pop": q.pop();break;
case "front": q.front();break;
default: break;
}
}
}
}