Decomposition

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

You are given an undirected complete graph with nn vertices, where nn is odd. You need to partition its edge set into kk disjoint simple paths, satisfying that the ii-th simple path has length l_il\_i, and each undirected edge is used exactly once. The given lengths l_il\_i are integers from 11 to n3n - 3.

A complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge. A simple path is a path where vertices are pairwise distinct. The length of a path is the number of edges in it.

It can be shown that an answer always exists if _i=1kl_i=n(n1)2\displaystyle \sum\limits\_{i=1}^k l\_i = \frac{n(n-1)}{2} holds.

입력

The first line contains an integer TT (1T1051 \leq T \leq 10^5), the number of test cases. Then TT test cases follow.

The first line of each test case contains two integers nn and kk (5n10005 \leq n \leq 1000, 1kn(n1)21 \leq k \leq \frac{n(n - 1)}{2}, nn is odd), the number of vertices and paths, respectively. The second line contains kk integers l_1,l_2,,l_kl\_1, l\_2, \ldots, l\_k (1l_in31 \le l\_i \le n - 3), the required lengths of the paths.

It is guaranteed that _i=1kl_i=n(n1)2\displaystyle \sum\limits\_{i = 1}^{k} l\_i = \frac{n(n - 1)}{2} holds for each test case.

It is also guaranteed for the total number of edges over all test cases that n(n1)2106\displaystyle \sum \frac{n(n - 1)}{2} \leq 10^6.

출력

For each test case, start by printing one line containing "Case #x:", where xx (1xT1 \leq x \leq T) is the test case number. Then output kk lines. In the ii-th of these lines, print l_i+1l\_i + 1 integers denoting the vertices of the ii-th path in order of traversal.

If there are multiple answers, print any one of them.