{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eMakomuno has N servers and M databases. All databases are synchronized among all servers and each database has a ordered list denotes the priority of servers to access. This list is guaranteed to be a valid permutation of all servers.\u003cbr\u003eEvery time someone wants to execute queries on a certain database, he will send a request to the first server in the list. If it\u0027s dead, he will simply turn to the next one. Otherwise a working copy of the database is found, and this copy is called active.\u003cbr\u003eNow, given N and M, Makomuno wants to find a permutation for each database which could assure that all servers are load-balanced. Moreover, Makomuno hopes the system will be load-balanced even if \u003cb\u003eexactly\u003c/b\u003e one server is broken.\u003cbr\u003eNote that if we call the number of active copies on i-th server A\u003csub\u003ei\u003c/sub\u003e, then load-balanced means max∣A\u003csub\u003ei\u003c/sub\u003e - A\u003csub\u003ej\u003c/sub\u003e∣≤1 for any i and j in non broken servers set. We won\u0027t consider broken servers in this case. \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains several test cases, terminated by EOF.\u003cbr\u003eEach test case has one line containing two integer N ( 2≤N≤100) and M ( 1≤M≤100). "}},{"title":"Output","value":{"format":"HTML","content":"For each case output M lines, the i-th line contains a permutation of all servers, indicating the expected order. Servers are numbered from 1 to n.\u003cbr\u003e"}},{"title":"Sample","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\u003e5 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 4 3 1 5\r\n1 5 4 2 3\r\n3 5 2 4 1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003eIn the sample test case, the active copies of these databases are on server 2,1 and 3 in normal state. A \u003d {1,1,1,0,0}\u003cbr\u003eIf server 1 or 3 has broken, server 5 will take its work. In case we lost server 2, the second database will use server 4 instead. A \u003d {1,BROKEN,1,1,0}\u003cbr\u003eIt\u0027s clear that in any case this system is load-balanced according to the plan in sample output. \u003cbr\u003e"}}]}