Lottery
Limits: 2 sec., 512 MiB
Once two friends Vitalik and Roman decided to play a lottery. They have already bought a lottery ticket which contains rectangular \(N \times M\) table filled with integer numbers. In order to play the guys have to choose one of the numbers and cross the corresponding cell.
Vitalik believes they have to choose the smallest number while Roman feels the largest one should bring luck. As they had the only ticket their dispute took few days. Finally they have decided to do the following. First, Vitalik chooses a table column and then Roman chooses a cell within the column. Your taks is to find the number which will be selected by the guys.
Input
The first line contains two integers \(N\) and \(M\). Each of the following \(N\) lines contains \(M\) integers — \(A_{ij}\). Here \(A_{ij}\) is the \(j\)-th number in the \(i\)-th table row of the lottery ticket.
Output
The number selected by Vitalik and Roman.
Constraints
\(40\%\) of tests:
\(1 \le N,M \le 50,\)
\(1 \le A_{ij} \le 1000\)
\(60\%\) of tests:
\(51 \le N,M \le 1000,\)
\(1 \le A_{ij} \le 1000\)
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 3 3 1 2 77 18 26 11 25 25 25 | 25 |
Notes
As Vitalik chooses the first column Roman can not select a number greater than 25.
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|