const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
    // Write your code here
    let arr = [];
    let len = await readline();
    let obj = {
        push:(n)=>arr.push(n),
        pop:()=>arr.shift(),
        front:()=>arr[0]
    }
    for(let i =0;i<len;i++){
        let sk = (await readline()).split(' ');
        let type = sk[0];
        let value = sk[1];
        type!=='push'?  console.log(obj[type]()||'error'):obj[type](value)
        
    }
}()