Johnny just got a lot of sugar from his PaPa!
However, Johnny is too excited that he accidently fall and all of the sugar just fall onto the ground.
PaPa is angry, and asked Johnny to clean the room up and take all his sugar away.
After Johnny's begging, PaPa thought of a problem. If Johnny could solve it, PaPa may just forgive him.
The sugar now seperated on the ground. The ground is a 2D coordinate with n * n slots, each slot has several pieces of sugar. PaPa will give Johnny the number of pieces of sugar in each slot. Johnny needs to answer the maximum number of every row and the minimum number of every column, otherwise, he will be punished!
Johnny is a bad boy, he command you to help him, and if you do it well, he will not give you any sugar, but you'll receive an AC.
The first line contains only one integer that indicates the number n.
The next n lines, each line contains n non-negitive integers, PaPa will give you the number of pieces of sugar in each slot.
1 <= n <=1000, each piece of sugar will not excceed 50000.
The first line, output the maximum number of each row. There should be n numbers.
The second line, output the minimum number of each column. There should be n numbers, too.
There should be a space next to each number except the last number, which means there should be no space at the end of each line.
Remember to output a '\n' at the end of the output.