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 line1 = (await readline()).split(" ").map(Number);
    let arrLenMax = line1[0];
    let len = line1[1];
    let arr = [];
    let obj = {
        push: (n) => {
            if (arr.length < arrLenMax) {
                arr.push(n);
            } else {
                console.log("full");
            }
        },
        pop: () => {
            if (!arr.length) {
                console.log("empty");
            } else {
                console.log(arr.shift());
            }
        },
        front: () => {
            if (!arr.length) {
                console.log("empty");
            } else {
                console.log(arr[0]);
            }
        },
    };
    for (let i = 0; i < len; i++) {
        let line = (await readline()).split(' ');
        let type=line[0];
        type ==='push'?obj[type](line[1]):obj[type]()
        
    }
})();