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 len = await readline(); let arr = []; let obj = { 'push':(n)=>arr.push(n), 'pop':()=>arr.pop()||'error', 'top':()=>arr[arr.length-1]||'error' } for(let i = 0;i<len;i++){ let str = await readline(); str.split(' ')[0] !=='push'?console.log(obj[str.split(' ')[0]]()): obj[str.split(' ')[0]](str.split(' ')[1]) } }()