Prefix Suffix Reconstruction#12226

Prefix Suffix Reconstruction

1 second
256 megabytes
Very easy

Given an integer , prefix sum array of and suffix sum array of , Determine if we can recover a valid array from the given info.

We define prefix array sum of array as sum of first elements.

We define suffix array sum of array as sum of last elements.

Input

The first line contains single integer (1 \le t \le 10^4) – the number of test cases.

The first line of each test case contains single integer (1 \le n \le 10^5) – the length of array .

The second line of each test case contains separated integers p_1,p_2,..,p_n (-10^9 \le p_1,p_2,..,p_n \le 10^9) – the prefix sum of array .

The third line of each test case contains separated integers s_1,s_2,..,s_n (-10^9 \le s_1,s_2,..,s_n \le 10^9) – the suffix sum of array .

It's guaranteed that sum of overall tests doesn't exceed 10^5.

Output

For each test case, If we can recover the array then , print the array a_1,a_2,..,a_n otherwise print -.

Examples

Example 1

Loading
Loading

Note

For the first test case , a=[1,1,1,1] works , because if we constructed the prefix sum we've :

  1. p_1=a_1=1

  2. p_2=a_1+a_2=2

  3. p_3=a_1+a_2+a_3=3

  4. p_4=a_1+a_2+a_3+a_4=4

Now construct the suffix sum we've :

  1. s_1=a_4=1

  2. s_2=a_4+a_3=2

  3. s_3=a_4+a_3+a_2=3

  4. s_4=a_4+a_3+a_2+a_1=4

Which matches our desire.

Scoring

  1. Subtask ( points) : (n=3)

  2. Subtask ( points) : (1 \le \sum n \le 500)

  3. Subtask ( points) : (1 \le p_1 \le p_2 \le ... \le p_n) and (1 \le s_1 \le s_2 \le .. \le s_n) is satisfied.

  4. Subtask ( points) : No additional constraints.