Equality

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian as well.
<meta charset="utf8" />An equation is an equality containing one or more variables. Solving the equation consists of determining which values of the variables make the equality true. In this situation, variables are also known as unknowns and the values which satisfy the equality are known as solutions. An equation differs from an identity in that an equation is not necessarily true for all possible values of the variable.
There are many types of equations, and they are found in all areas of mathematics. For instance, a linear equation is an algebraic equation in which each term is either a constant or the product of a constant and (the first power of) a single variable.
In this problem we'll consider quite a special kind of systems of linear equations. To be more specific, you are given a system of N linear equations of the following form:
 x_{2} + x_{3} + ... + x_{N  1} + x_{N} = a_{1}
 x_{1} + x_{3} + ... + x_{N  1} + x_{N} = a_{2}
 ...
 x_{1} + x_{2} + ... + x_{N  2} + x_{N} = a_{N  1}
 x_{1} + x_{2} + ... + x_{N  2} + x_{N  1} = a_{N}
In other words, i'th equation of the system consists of the sum of all the variable x_{1}, ..., x_{N} except x_{i} to the left of the equality sign and the constant a_{i} to the right of the equality sign.
One can easily prove, that a system of linear equations as described above always have exactly one solution in case N is greater than one. Your task is to find the solution of the system(such a sequence x_{1}, x_{2}, ..., x_{N}, that turns each of the equations into equality). It's guaranteed, that the solution of the system is a sequence consisting only of integers from the range [1, 10^{8}].
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of the test case description contains one integer N denoting the number of equations in the system.
The second line contains N integers a_{1}, a_{2}, ..., a_{N} denoting the constants defining a system of linear equations, that you are asked to solve.
Output
For each test case, output a single line containing N integers: a sequence x_{1}, x_{2}, ..., x_{N}, which is the solution of the system.Constraints
Example
Input: 2 3 9 6 5 4 13 11 10 8 Output: 1 4 5 1 3 4 6
Explanation
In the first test case, we can simply replace the variables with the values from the correct output to make sure, that all the conditions are satisfied:
 x_{2} + x_{3} = 4 + 5 = 9 = a_{1}
 x_{1} + x_{3} = 1 + 5 = 6 = a_{2}
 x_{1} + x_{2} = 1 + 4 = 5 = a_{3}
In the second test case, we can repeat the same process to make sure, that all the conditions are satisfied:
 x_{2} + x_{3} + x_{4} = 3 + 4 + 6 = 13 = a_{1}
 x_{1} + x_{3} + x_{4} = 1 + 4 + 6 = 11 = a_{2}
 x_{1} + x_{2} + x_{4} = 1 + 3 + 6 = 10 = a_{3}
 x_{1} + x_{2} + x_{3} = 1 + 3 + 4 = 8 = a_{4}
Author:  kostya_by 
Tester:  stzgd 
Editorial  http://discuss.codechef.com/problems/EQUALITY 
Tags  cook57, easy, kostya_by, linearalgebra, math 
Date Added:  16032015 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions