{"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":"","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\u003eAlex is a professional computer game player.\u003c/p\u003e\n\u003cp\u003eThese days, Alex is playing a war strategy game. His city can be regarded as a rectangle on the Cartesian plane. Its lower-left corner is $$$(0,0)$$$, and its upper-right corner is $$$(n+1,n+1)$$$. \u003c/p\u003e\n\u003cp\u003eAlex builds $$$n$$$ defensive towers to protect the city. The defensive tower $$$i$$$ is located at $$$(x_i,y_i)$$$, and its direction is $$$d_i$$$. The defensive towers with different directions protect different areas:\u003c/p\u003e\n\u003cul\u003e \n \u003cli\u003e if $$$d_i \u003d 1$$$, the defensive tower $$$i$$$ can protect area $$$\\{(a,b)\\mid a \\ge x_i, b \\ge y_i\\}$$$; \u003c/li\u003e\n \u003cli\u003e if $$$d_i \u003d 2$$$, the defensive tower $$$i$$$ can protect area $$$\\{(a,b)\\mid a \\le x_i, b \\ge y_i\\}$$$; \u003c/li\u003e\n \u003cli\u003e if $$$d_i \u003d 3$$$, the defensive tower $$$i$$$ can protect area $$$\\{(a,b)\\mid a \\le x_i, b \\le y_i\\}$$$; \u003c/li\u003e\n \u003cli\u003e if $$$d_i \u003d 4$$$, the defensive tower $$$i$$$ can protect area $$$\\{(a,b)\\mid a \\ge x_i, b \\le y_i\\}$$$. \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eIf Alex launches $$$e$$$ defensive towers, he will consume $$$e$$$ energy per hour. He wants to launch as few defensive towers as possible so that all points $$$(x,y)\\ (x,y\\in \\mathbb{R},0 \\le x,y \\le n+1)$$$ in his city can be protected. Can you find the optimal strategy?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input gives the number of test cases, $$$T\\ (1 \\le T \\le 10^4)$$$. $$$T$$$ test cases follow.\u003c/p\u003e\n\u003cp\u003eFor each test case, the first line contains an integer $$$n\\ (1 \\le n \\le 10^6)$$$, where $$$n$$$ is the number of defenases doesn\u0027t exceed $$$5 \\times 10^6$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output one line containing \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eCase #x: y\u003c/span\u003e\", where $$$\\texttt{x}$$$ is the test case number (starting from $$$1$$$), and $$$\\texttt{y}$$$ is the minimum number of defensive towers. If it is impossible to protect all the city, output \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eImpossible\u003c/span\u003e\" (without quote).\u003c/p\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\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 1 1\n2 2 3\n2 1 2\n1 2 4\n\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: Impossible\nCase #2: 4\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}