LearnPy Hub
← Arena
EasyRating 900

Row Maximums, Column Minimums

Print the maximum of each row on one line, and the minimum of each column on the next.

Input

r c, then r lines.

Output

Two lines.

Sample 1

Input
2 3
1 5 3
4 2 6
Output
5 6
1 2 3

Sample 2

Input
1 1
7
Output
7
7
solution.py
Output appears here
Row Maximums, Column Minimums · Python Arena problem · LearnPy Hub