Problem list
Log in
#coci00267 · COCI 2012/2013 Contest 6

Sume

Silver IV 1.0 s 32 MB

Once upon a time, there existed a sequence A consisting of N 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 A!

Input

The first line of input contains the positive integer N ($2 \le N \le 1000$). Each of the following N lines contains N positive integers smaller than or equal to 100 000, forming the table S. The following relations hold: S(i, j) = A[i] + A[j] for $i \ne j$, and S(i, j) = 0 for $i = j$. Here S(i, j) denotes the number in the i^{th} row and j^{th} column of the table, and A[i] denotes the i^{th} element of the sequence A. It is guaranteed that for any input data set there exists a unique sequence of positive integers A with the given properties.

Output

The first and only line of output must contain the required sequence A (in the form of N space-separated positive integers).

Example 1

Input
2
0 2
2 0
Output
1 1

Example 2

Input
4
0 3 6 7
3 0 5 6
6 5 0 9
7 6 9 0
Output
2 1 4 5
Source
COCI 2012/2013 Contest 6
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code