You are given an undirected complete graph with n vertices, where n is odd. You need to partition its edge set into k disjoint simple paths, satisfying that the i-th simple path has length l_i, and each undirected edge is used exactly once. The given lengths l_i are integers from 1 to n−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=2n(n−1) holds.
The first line contains an integer T (1≤T≤105), the number of test cases. Then T test cases follow.
The first line of each test case contains two integers n and k (5≤n≤1000, 1≤k≤2n(n−1), n is odd), the number of vertices and paths, respectively. The second line contains k integers l_1,l_2,…,l_k (1≤l_i≤n−3), the required lengths of the paths.
It is guaranteed that ∑_i=1kl_i=2n(n−1) holds for each test case.
It is also guaranteed for the total number of edges over all test cases that ∑2n(n−1)≤106.
For each test case, start by printing one line containing "Case #x:", where x (1≤x≤T) is the test case number. Then output k lines. In the i-th of these lines, print l_i+1 integers denoting the vertices of the i-th path in order of traversal.
If there are multiple answers, print any one of them.