{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eWe have a grid with \u003cvar\u003e\\(H\\)\u003c/var\u003e rows and \u003cvar\u003e\\(W\\)\u003c/var\u003e columns of squares.\r\nSnuke is painting these squares in colors \u003cvar\u003e\\(1\\)\u003c/var\u003e, \u003cvar\u003e\\(2\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, \u003cvar\u003e\\(N\\)\u003c/var\u003e.\r\nHere, the following conditions should be satisfied:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eFor each \u003cvar\u003e\\(i\\)\u003c/var\u003e (\u003cvar\u003e\\(1 ≤ i ≤ N\\)\u003c/var\u003e), there are exactly \u003cvar\u003e\\(a_i\\)\u003c/var\u003e squares painted in Color \u003cvar\u003e\\(i\\)\u003c/var\u003e. Here, \u003cvar\u003e\\(a_1 + a_2 + ... + a_N \u003d H W\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eFor each \u003cvar\u003e\\(i\\)\u003c/var\u003e (\u003cvar\u003e\\(1 ≤ i ≤ N\\)\u003c/var\u003e), the squares painted in Color \u003cvar\u003e\\(i\\)\u003c/var\u003e are \u003cem\u003e4-connected\u003c/em\u003e. That is, every square painted in Color \u003cvar\u003e\\(i\\)\u003c/var\u003e can be reached from every square painted in Color \u003cvar\u003e\\(i\\)\u003c/var\u003e by repeatedly traveling to a horizontally or vertically adjacent square painted in Color \u003cvar\u003e\\(i\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eFind a way to paint the squares so that the conditions are satisfied.\r\nIt can be shown that a solution always exists.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ H, W ≤ 100\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ N ≤ H W\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(a_i ≥ 1\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(a_1 + a_2 + ... + a_N \u003d H W\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(H\\)\u003c/var\u003e \u003cvar\u003e\\(W\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(a_1\\)\u003c/var\u003e \u003cvar\u003e\\(a_2\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(a_N\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint one way to paint the squares that satisfies the conditions.\r\nOutput in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(c_{1 1}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(c_{1 W}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(c_{H 1}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(c_{H W}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003cp\u003eHere, \u003cvar\u003e\\(c_{i j}\\)\u003c/var\u003e is the color of the square at the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th row from the top and \u003cvar\u003e\\(j\\)\u003c/var\u003e-th column from the left.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003e2 2\r\n3\r\n2 1 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\r\n2 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eBelow is an example of an invalid solution:\u003c/p\u003e\r\n\u003cpre\u003e1 2\r\n3 1\r\n\u003c/pre\u003e\r\n\r\n\u003cp\u003eThis is because the squares painted in Color \u003cvar\u003e\\(1\\)\u003c/var\u003e are not 4-connected.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e3 5\r\n5\r\n1 2 3 4 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 4 4 4 3\r\n2 5 4 5 3\r\n2 5 5 5 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e1 1\r\n1\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}