Jonas and Artūras are playing a game. Jonas lays out two rows of cards, each row containing N cards. Every card has an integer between 1 and N written on it, and within a single row each value from 1 to N appears exactly once — so each row is a permutation of 1,2,…,N.
Artūras cannot see the numbers. To learn them, he compares cards across the two rows: he picks one card from the first row and one card from the second row and asks Jonas which of the two values is larger. Jonas replies that the first card is larger, that the second card is larger, or that the two cards are equal.
Artūras has already compared every card of the first row against every card of the second row and recorded all of the answers as a table. Let the result of comparing the i-th card of the first row with the j-th card of the second row be the integer ri,j:
Given the whole table, determine the integer written on every card in both rows.
The first line contains one integer N — the number of cards in each row.
Each of the next N lines contains N integers. The j-th integer on the i-th of these lines is ri,j∈{−1,0,1}, the comparison result between the i-th card of the first row and the j-th card of the second row.
Print two lines.
The answer is uniquely determined by the input.