Pigeon Holes
In the staff lounge at GIHS, the pigeon hole cabinet is frequently collapsing because some pigeon holes are too heavy!
The pigeon holes are arranged in an grid in the teachers' staff room, one for each of the
teachers at GIHS.
Some pigeon holes are too heavy and overflowing for one of two reasons. Either there are too many letters arriving in certain teachers' pigeon holes, or some teachers forget to check their pigeon hole often.
Regardless of why the pigeon holes are overflowing, the maintenance team wants a fast program to tell them the heaviest pigeon hole weight in each column of the pigeon hole grid so they can alert the teachers to clear out their pigeon holes and stop the collapse!
Input
The first line contains two integes and
, representing the number of rows and columns of pigeon holes respectively.
There are then lines to represent a row of the pigeon hole grid.
Each row contains integers, which are the weights
of each pigeon hole in the current row.
represents the weight of the pigeon hole on row
column
.
Output
Output the heaviest pigeon hole weight in each column of the pigeon hole grid.
This will allow the maintenance staff to tell the teachers with overflowing pigeon holes to clear them out!
Output each of the heaviest weights on a new line.
Example
Input 1
3 3
1 2 1
3 2 0
0 1 0
Output 1
3
2
1

- Miss D has the heaviest pigeon hole in column 0 at weight 3.
- Mrs B and Mr E both have the heaviest weight in column 2 at weight 2.
- Mr C has the heaviest pigeon hole in column 2 at weight 1.
Input 2
2 3
0 15 4
3 4 8
Output 2
3
15
8
Input 3
1 1
5
Output 3
5
Comments