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 line = Number(await readline()); let arr = []; let obj = { insert: (a, b) => { if (arr.indexOf(a) === -1) { arr.push(b); } else { arr.splice(arr.indexOf(a), 0, b); } }, delete: (a) => { if (arr.indexOf(a) !== -1) { arr.splice(arr.indexOf(a), 1); } }, }; for (let i = 0; i < line; i++) { let sk = (await readline()).split(" "); let type = sk[0]; sk.shift(); obj[type](...sk); } console.log(arr.join(' ')||'NULL') })();