{"trustable":false,"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"Contest Announcement","value":{"format":"HTML","content":"In case of some loading problem, PDF of all problem statements of this contest can be found at https://drive.google.com/open?id\u003d1_aNwW972tRz9w5oTp_olN6pbGAxI7nVF"}},{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\u0027text/css\u0027\u003e .input, .output {border: 1px solid #888888;} .output {margin-bottom:1em;position:relative;top:-1px;} .output pre,.input pre {background-color:#EFEFEF;line-height:1.25em;margin:0;padding:0.25em;} .title {background-color:#FFFFFF;border-bottom: 1px solid #888888;font-family:arial;font-weight:bold;padding:0.25em;} \u003c/style\u003e \u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027]], displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027]]}\n });\n \u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\" async\n src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\n \u003c/script\u003e\n\u003cp\u003eAs an ACM-ICPC newbie, Aishah is learning data structures in computer science. She has already known that a stack, as a data structure, can serve as a collection of elements with two operations:\u003c/p\u003e\n\u003cul\u003e \n \u003cli\u003e push, which inserts an element to the collection, and \u003c/li\u003e\n \u003cli\u003e pop, which deletes the most recently inserted element that has not yet deleted. \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eNow, Aishah hopes a more intelligent stack which can display the maximum element in the stack dynamically. Please write a program to help her accomplish this goal and go through a test with several operations.\u003c/p\u003e\n\u003cp\u003eAishah assumes that the stack is empty at first. Your program will output the maximum element in the stack after each operation. If at some point the stack is empty, the output should be zero.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input contains several test cases, and the first line is a positive integer \u003ci\u003eT\u003c/i\u003e indicating the number of test cases which is up to 50.\u003c/p\u003e\n\u003cp\u003eTo avoid unconcerned time consuming in reading data, each test case is described by seven integers \u003ci\u003en (1 \u003c\u003d n \u003c\u003d 5 * 10^6), p, q, m (1 \u003c\u003d p, q, m \u003c\u003d 10^9), SA, SB and SC (10^4 \u003c\u003d SA, SB, SC \u003c\u003d 10^6)\u003c/i\u003e. The integer \u003ci\u003en\u003c/i\u003e is the number of operations, and your program is asked to generate all operations by using the following code in C\u003cspan class\u003d\"tex-font-style-tt\"\u003e++\u003c/span\u003e.\u003c/p\u003e\n\n\u003cimg src\u003d\"https://i.ibb.co/JH9GYPC/A-code.png\" alt\u003d\"Image Failed To Load\"\u003e\n\n\u003cp\u003eThe procedure \u003cspan class\u003d\"tex-font-style-tt\"\u003ePUSH(v)\u003c/span\u003e used in the code inserts a new element with value \u003ci\u003ev\u003c/i\u003e into the stack and the procedure \u003cspan class\u003d\"tex-font-style-tt\"\u003ePOP()\u003c/span\u003e pops the topmost element in the stack or does nothing if the stack is empty.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cimg src \u003d \"https://i.ibb.co/g7Bs2xV/A-output.png\" alt \u003d\"Image Failed To Load\"\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e2\u003cbr\u003e4 1 1 4 23333 66666 233333\u003cbr\u003e4 2 1 4 23333 66666 233333\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003eCase #1: 19\u003cbr\u003eCase #2: 1\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe first test case in the sample input has 4 operations: \u003c/p\u003e\n\u003cul\u003e \n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePOP()\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePOP()\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePUSH(1)\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePUSH(4)\u003c/span\u003e. \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe second test case also has 4 operations: \u003c/p\u003e\n\u003cul\u003e \n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePUSH(2)\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePOP()\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePUSH(1)\u003c/span\u003e; \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ePOP()\u003c/span\u003e. \u003c/li\u003e\n\u003c/ul\u003e"}}]}