COCI '12 Contest 6 #2 Sume
View as PDFOnce upon a time, there existed a sequence  consisting of 
 positive integers. You don't know the sequence itself, but you do know the sum of every two elements of the sequence. Find the sequence 
!
Input Specification
The first line of input contains the positive integer  
.
Each of the following  lines contains 
 positive integers smaller than or equal to 
, forming the table 
. The following relations hold: 
 for 
, and 
 for 
. Here 
 denotes the number in the 
 row and 
 column of the table, and 
 denotes the 
 element of the sequence 
.
It is guaranteed that for any input data set there exists a unique sequence of positive integers  with the given properties.
Output Specification
The first and only line of output must contain the required sequence  (in the form of 
 space-separated positive integers).
Sample Input 1
2
0 2
2 0
Sample Output 1
1 1
Sample Input 2
4
0 3 6 7
3 0 5 6
6 5 0 9
7 6 9 0
Sample Output 2
2 1 4 5
Comments
Is 0 a positive integer /s?
no/s