We have a tree ⟨V,E⟩ that consists of n vertices numbered from 1 to n. Each vertex i∈V has weight a_i. Each bidirectional edge e=⟨u,v⟩∈E has weight b_e. Here, a_i are non-negative integers, and b_e are integers.
You can perform at most 4n operations. For each operation, select two vertices X and Y, and a non-negative integer W. Consider the shortest path from X to Y (a path is shortest if the number of edges k in it is minimum possible). Let this path consist of k+1 vertices (v_0,v_1,v_2,…,v_k) where v_0=X, v_k=Y, and for 0≤i<k, the edges e_i=⟨v_i,v_i+1⟩∈E. The operation changes the weights as follows:
a_X←a_X⨁W;a_Y←a_Y⨁W;b_e_i←b_e_i+(−1)i⋅W for 0≤i<k.
Here, ⨁ denotes the bitwise XOR operation. We can notice that, if X=Y, nothing will change.
You need to decide whether it is possible to make all a_i and all b_e equal to 0. If it is possible, find a way to do so.
The first line contains an integer T (1≤T≤250), the number of test cases. Then T test cases follow.
The first line of each test case contains a single integer n (1≤n≤104), the number of vertices.
The second line contains n non-negative integers a_i (0≤a_i<230), the weight on each vertex.
Then n−1 lines follow, each of them contains three integers u_j, v_j, w_j (1≤u_j,v_j≤n, −109≤w_j≤109), representing an edge between vertices u_j and v_j with weight w_j. It is guaranteed that the given edges form a tree.
It is guaranteed that ∑n≤105.
For each test case, output "YES" on the first line if you can make all a_i and all b_e equal to 0 with no more than 4n operations. Output "NO" otherwise.
If you can make all weights equal to 0, output your solution in the following k+1 (0≤k≤4n) lines as follows.
On the next line, print an integer k: the number of operations you make.
Then print k lines, each line containing three integers X, Y, and W (1≤X,Y≤n, 0≤W≤1014), representing one operation.
If there are several possible solutions, print any one of them.