Once there was a special graph. This graph had $n$ vertices and some edges. Each edge was either white or black. There was no edge connecting one vertex and the vertex itself. There was no two edges connecting the same pair of vertices. It is special because the each vertex is connected to at most two black edges and at most two white edges.
One day, the demon broke this graph by copying all the vertices and in one copy of the graph, the demon only keeps all the black edges, and in the other copy of the graph, the demon keeps all the white edges. Now people only knows there are $w_0$ vertices which are connected with no white edges, $w_1$ vertices which are connected with $1$ white edges, $w_2$ vertices which are connected with $2$ white edges, $b_0$ vertices which are connected with no black edges, $b_1$ vertices which are connected with $1$ black edges and $b_2$ vertices which are connected with $2$ black edges.
The precious graph should be fixed to guide people, so some people started to fix it. If multiple initial states satisfy the restriction described above, print any of them.
输入解释
The first line of the input is a single integer $T \ (T \le 700)$, indicating the number of testcases.
Each of the following $T$ lines contains $w_0,w_1,w_2,b_0,b_1,b_2$. It is guaranteed that $1 \le w_0,w_1,w_2,b_0,b_1,b_2 \le 2000$ and $b_0+b_1+b_2=w_0+w_1+w_2$.
It is also guaranteed that the sum of all the numbers in the input file is less than $300000$.
输出解释
For each testcase, if there is no available solution, print $-1$. Otherwise, print $m$ in the first line, indicating the total number of edges. Each of the next $m$ lines contains three integers $x,y,t$, which means there is an edge colored $t$ connecting vertices $x$ and $y$. $t=0$ means this edge white, and $t=1$ means this edge is black. Please be aware that this graph has no self-loop and no multiple edges. Please make sure that $1 \le x, y \le b_0 + b_1 + b_2$.