{"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\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":"\u003cp\u003eLet us define a \u003cspan class\u003d\"tex-font-style-it\"\u003emagic\u003c/span\u003e grid to be a square matrix of integers of size $$$n \\times n$$$, satisfying the following conditions. \u003c/p\u003e\u003cul\u003e \u003cli\u003e All integers from $$$0$$$ to $$$(n^2 - 1)$$$ inclusive appear in the matrix \u003cspan class\u003d\"tex-font-style-bf\"\u003eexactly once\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e \u003ca href\u003d\"https://en.wikipedia.org/wiki/Bitwise_operation#XOR\"\u003eBitwise XOR\u003c/a\u003e of all elements in a row or a column must be the same for each row and column. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou are given an integer $$$n$$$ which is a \u003cspan class\u003d\"tex-font-style-bf\"\u003emultiple of $$$4$$$\u003c/span\u003e. Construct a \u003cspan class\u003d\"tex-font-style-it\"\u003emagic\u003c/span\u003e grid of size $$$n \\times n$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe only line of input contains an integer $$$n$$$ ($$$4 \\leq n \\leq 1000$$$). It is guaranteed that $$$n$$$ is a multiple of $$$4$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint a \u003cspan class\u003d\"tex-font-style-it\"\u003emagic\u003c/span\u003e grid, i.e. $$$n$$$ lines, the $$$i$$$-th of which contains $$$n$$$ space-separated integers, representing the $$$i$$$-th row of the grid.\u003c/p\u003e\u003cp\u003eIf there are multiple answers, print any. We can show that an answer always exists.\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\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8 9 1 13\n3 12 7 5\n0 2 4 11\n6 10 15 14\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\u003e8\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e19 55 11 39 32 36 4 52\n51 7 35 31 12 48 28 20\n43 23 59 15 0 8 16 44\n3 47 27 63 24 40 60 56\n34 38 6 54 17 53 9 37\n14 50 30 22 49 5 33 29\n2 10 18 46 41 21 57 13\n26 42 62 58 1 45 25 61\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example, XOR of each row and each column is $$$13$$$.\u003c/p\u003e\u003cp\u003eIn the second example, XOR of each row and each column is $$$60$$$.\u003c/p\u003e"}}]}