9340 - Polynomial Addition   

Description

Given two polynomials

please calculate the result of adding these two polynomials.

 

 

9340 : 0 < n,m <= 15 , absolute value of all coefficients are less or equal than 105

9341 : 0 < n,m <= 105 , absolute value of all coefficients are less or equal than 1005

9342 : 0 < n,m <= 1005 , absolute value of all coefficients are less or equal than (10^7 + 5)

9343 : 0 < n,m <= 1005 , absolute value of all coefficients are less or equal than (2*10^9 + 5)

 

The input size is very large, don't use cin for input.

Input

The first line contains an integer t , which indicates the number of test cases in the input.

For each case, the first line contains two integers n, m. Integer n means the highest power of the first polynomial. Integer m means the highest power of the second polynomial. In the next 2 lines, the first line contains n+1 integers, which means the coefficients of the polynomial A from high to low. The second line contains m+1 integers, which means the coefficients of the polynomial B from high to low.

Output

For each case, output a line with the coefficients of the polynomial A+B. There is a space between two consecutive numbers.

Sample Input  Download

Sample Output  Download

Tags




Discuss