{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eDima has a birthday soon! It\u0027s a big day! Saryozha\u0027s present to Dima is that Seryozha won\u0027t be in the room and won\u0027t disturb Dima and Inna as they celebrate the birthday. Inna\u0027s present to Dima is a stack, a queue and a deck.\u003c/p\u003e\u003cp\u003eInna wants her present to show Dima how great a programmer he is. For that, she is going to give Dima commands one by one. There are two types of commands:\u003c/p\u003e\u003col\u003e \u003cli\u003e Add a given number into one of containers. For the queue and the stack, you can add elements only to the end. For the deck, you can add elements to the beginning and to the end. \u003c/li\u003e\u003cli\u003e Extract a number from each of at most three distinct containers. Tell all extracted numbers to Inna and then empty all containers. In the queue container you can extract numbers only from the beginning. In the stack container you can extract numbers only from the end. In the deck number you can extract numbers from the beginning and from the end. You cannot extract numbers from empty containers. \u003c/li\u003e\u003c/ol\u003e\u003cp\u003eEvery time Dima makes a command of the second type, Inna kisses Dima some (possibly zero) number of times. Dima knows Inna perfectly well, he is sure that this number equals the sum of numbers he extracts from containers during this operation.\u003c/p\u003e\u003cp\u003eAs we\u0027ve said before, Dima knows Inna perfectly well and he knows which commands Inna will give to Dima and the order of the commands. Help Dima find the strategy that lets him give as more kisses as possible for his birthday!\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains integer \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 10\u003csup class\u003d\"upper-index\"\u003e5\u003c/sup\u003e)\u003c/span\u003e — the number of Inna\u0027s commands. Then \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e lines follow, describing Inna\u0027s commands. Each line consists an integer:\u003c/p\u003e\u003col\u003e \u003cli\u003e Integer \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(1 ≤ \u003ci\u003ea\u003c/i\u003e ≤ 10\u003csup class\u003d\"upper-index\"\u003e5\u003c/sup\u003e)\u003c/span\u003e means that Inna gives Dima a command to add number \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003c/span\u003e into one of containers. \u003c/li\u003e\u003cli\u003e Integer \u003cspan class\u003d\"tex-span\"\u003e0\u003c/span\u003e shows that Inna asks Dima to make at most three extractions from different containers. \u003c/li\u003e\u003c/ol\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eEach command of the input must correspond to one line of the output — Dima\u0027s action.\u003c/p\u003e\u003cp\u003eFor the command of the first type (adding) print one word that corresponds to Dima\u0027s choice:\u003c/p\u003e\u003cul\u003e \u003cli\u003e pushStack — add to the end of the stack; \u003c/li\u003e\u003cli\u003e pushQueue — add to the end of the queue; \u003c/li\u003e\u003cli\u003e pushFront — add to the beginning of the deck; \u003c/li\u003e\u003cli\u003e pushBack — add to the end of the deck. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor a command of the second type first print an integer \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ek\u003c/i\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(0 ≤ \u003ci\u003ek\u003c/i\u003e ≤ 3)\u003c/span\u003e, that shows the number of extract operations, then print \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ek\u003c/i\u003e\u003c/span\u003e words separated by space. The words can be:\u003c/p\u003e\u003cul\u003e \u003cli\u003e popStack — extract from the end of the stack; \u003c/li\u003e\u003cli\u003e popQueue — extract from the beginning of the line; \u003c/li\u003e\u003cli\u003e popFront — extract from the beginning from the deck; \u003c/li\u003e\u003cli\u003e popBack — extract from the end of the deck. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe printed operations mustn\u0027t extract numbers from empty containers. Also, they must extract numbers from distinct containers.\u003c/p\u003e\u003cp\u003eThe printed sequence of actions must lead to the maximum number of kisses. If there are multiple sequences of actions leading to the maximum number of kisses, you are allowed to print any of them.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\n0\n1\n0\n1\n2\n0\n1\n2\n3\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\npushStack\n1 popStack\npushStack\npushQueue\n2 popStack popQueue\npushStack\npushQueue\npushFront\n3 popStack popQueue popFront\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\n1\n2\n3\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003epushStack\npushQueue\npushFront\n3 popStack popQueue popFront\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}