시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB144359848741.236%

문제

양의 정수 N개로 이루어진 수열 A가 있다. 상근이는 수열 A의 모든 두 수의 합을 알고 있다. 이때, 수열 A를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 수열의 크기 N이 주어진다. (2 ≤ N ≤ 1000)

다음 N개 줄에는 100,000보다 작거나 같은 양의 정수가 N개씩 주어진다. 이 숫자들은 S를 이루는 숫자이며, S(i,j) = A[i] + A[j] (i≠j), S(i,j) = 0 (i=j) 이다. S(i,j)는 i번째 줄, j번째 숫자를 의미하며, A[i]는 A의 i번째 수이다.

입력으로 주어지는 S에 해당하는 수열 A는 항상 유일하다.

출력

첫째 줄에 수열 A를 출력한다.

예제 입력 1

2
0 2
2 0

예제 출력 1

1 1

예제 입력 2

4
0 3 6 7
3 0 5 6
6 5 0 9
7 6 9 0

예제 출력 2

2 1 4 5
W3sicHJvYmxlbV9pZCI6IjU2MjMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMyMThcdWM1ZjRcdWM3NTggXHVkNTY5IiwiZGVzY3JpcHRpb24iOiI8cD5cdWM1OTFcdWM3NTggXHVjODE1XHVjMjE4IE5cdWFjMWNcdWI4NWMgXHVjNzc0XHViOGU4XHVjNWI0XHVjOWM0IFx1YzIxOFx1YzVmNCBBXHVhYzAwIFx1Yzc4OFx1YjJlNC4gXHVjMGMxXHVhZGZjXHVjNzc0XHViMjk0IFx1YzIxOFx1YzVmNCBBXHVjNzU4IFx1YmFhOFx1YjRlMCBcdWI0NTAgXHVjMjE4XHVjNzU4IFx1ZDU2OVx1Yzc0NCBcdWM1NGNcdWFjZTAgXHVjNzg4XHViMmU0LiBcdWM3NzRcdWI1NGMsIFx1YzIxOFx1YzVmNCBBXHViOTdjIFx1YWQ2Y1x1ZDU1OFx1YjI5NCBcdWQ1MDRcdWI4NWNcdWFkZjhcdWI3YThcdWM3NDQgXHVjNzkxXHVjMTMxXHVkNTU4XHVjMmR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