{"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\"\u003eYou are given an undirected complete graph with $n$ vertices ($n$ is odd). You need to partition its edge set into $k$ $\\pmb{\\text{disjoint simple}}$ paths, satisfying that the $i$-th simple path has length $l_i$ ($1\\leq i \\leq k, 1 \\leq l_i \\leq n-3$), and each undirected edge is used exactly once. \u003cbr\u003e\u003cbr\u003eA complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge. A simple path with length $l$ here means the path covers $l$ edges, and the vertices in the path are pairwise distinct.\u003cbr\u003e\u003cbr\u003eIt can be proved that an answer always exists if $\\sum\\limits_{i\u003d1}^k l_i \u003d \\frac{n(n-1)}{2}$ holds.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains an integer $T(1 \\leq T \\leq 100000)$ - the number of test cases. Then $T$ test cases follow.\u003cbr\u003e\u003cbr\u003eThe first line of each test case contains two integers $n, k(5 \\leq n \\leq 1000, 1 \\leq k \\leq \\frac{n(n-1)}{2}, n \\equiv 1 \\pmod 2)$ - the number of vertices and paths.\u003cbr\u003e\u003cbr\u003eThe next line contains $k$ integers $l_1, l_2, \\cdots, l_k(1 \\le l_i \\le n-3)$ - the length of each path.\u003cbr\u003e\u003cbr\u003eIt is guaranteed that $\\sum\\limits_{i\u003d1}^k l_i \u003d \\frac{n(n-1)}{2}$ holds for each test case, and $\\sum \\frac{n(n-1)}{2} \\leq 4 \\times 10^6$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, firstly output one line containing \"Case #x:\", where $x(1 \\leq x \\leq T)$ is the test case number. Then output $k$ lines. the $i$-th line contains $l_i + 1$ numbers denoting the $i$-th path.\u003cbr\u003e\u003cbr\u003eIf there are multiple answers, print any.\u003cbr\u003e\u003cbr\u003e$\\pmb{\\text{Due to technical reasons, please, do not output extra spaces at the end of each line!}}$\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\u003e3\r\n5 6\r\n2 1 1 2 2 2\r\n7 8\r\n1 1 4 3 4 1 3 4\r\n5 10\r\n1 1 1 1 1 1 1 1 1 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1:\r\n5 4 2\r\n2 3\r\n5 1\r\n2 1 4\r\n3 5 2\r\n1 3 4\r\nCase #2:\r\n6 7\r\n1 3\r\n6 5 1 2 3\r\n7 1 4 2\r\n1 6 4 7 5\r\n7 3\r\n2 6 3 5\r\n3 4 5 2 7\r\nCase #3:\r\n5 3\r\n5 2\r\n4 3\r\n1 5\r\n1 3\r\n2 3\r\n4 2\r\n4 1\r\n1 2\r\n4 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}