CF1546A.AquaMoon and Two Arrays

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

AquaMoon and Two Arrays

AquaMoon and Cirno are playing an interesting game with arrays. Cirno has prepared two arrays aa and bb, both consist of nn non-negative integers. AquaMoon can perform the following operation an arbitrary number of times (possibly zero):

  • She chooses two indices ii and jj (1i,jn1 \le i, j \le n), then decreases the ii-th element of array aa by 11, and increases the jj-th element of array aa by 11. The resulting values at ii-th and jj-th index of array aa are ai1a_i - 1 and aj+1a_j + 1, respectively. Each element of array aa must be non-negative after each operation. If i=ji = j this operation doesn't change the array aa.

AquaMoon wants to make some operations to make arrays aa and bb equal. Two arrays aa and bb are considered equal if and only if ai=bia_i = b_i for all 1in1 \leq i \leq n.

Help AquaMoon to find a sequence of operations that will solve her problem or find, that it is impossible to make arrays aa and bb equal.

Please note, that you don't have to minimize the number of operations.

Input

The input consists of multiple test cases. The first line contains a single integer tt (1t1001 \leq t \leq 100) — the number of test cases.

The first line of each test case contains a single integer nn (1n1001 \leq n \leq 100).

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (0ai1000 \leq a_i \leq 100). The sum of all aia_i does not exceed 100100.

The third line of each test case contains nn integers b1,b2,,bnb_1, b_2, \dots, b_n (0bi1000 \leq b_i \leq 100). The sum of all bib_i does not exceed 100100.

Output

For each test case print "-1" on the only line if it is impossible to make two arrays equal with some sequence of operations.

Otherwise, print an integer mm (0m1000 \leq m \leq 100) in the first line — the number of operations. Then print mm lines, each line consists of two integers ii and jj — the indices you choose for the operation.

It can be proven that if it is possible to make two arrays equal with some sequence of operations, there exists a sequence with m100m \leq 100.

If there are multiple possible solutions, you can print any.

Note

In the first example, we do the following operations:

  • i=2i = 2, j=1j = 1: [1,2,3,4][2,1,3,4][1, 2, 3, 4] \rightarrow [2, 1, 3, 4];
  • i=3i = 3, j=1j = 1: [2,1,3,4][3,1,2,4][2, 1, 3, 4] \rightarrow [3, 1, 2, 4];

In the second example, it's impossible to make two arrays equal.

Samples

4
4
1 2 3 4
3 1 2 4
2
1 3
2 1
1
0
0
5
4 3 2 1 0
0 1 2 3 4
2
2 1
3 1
-1
0
6
1 4
1 4
1 5
1 5
2 5
2 5

在线编程 IDE

建议全屏模式获得最佳体验