#include <iostream>
using namespace std;
int main() {
int n = 0;
cin >> n;
int res[100000];
int end = 0;
int start = 0;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
if (str == "push") {
cin >> res[end++];
} else if (str == "pop") {
if (start < end) {
cout << res[start++] << endl;
} else {
cout << "error" << endl;
}
} else if (str == "front") {
if (start < end) {
cout << res[start] << endl;
} else {
cout << "error" << endl;
}
}
}
}

京公网安备 11010502036488号