Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/matrix/smallest-of-the-row-maximums

Smallest of the row maximums

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 128 MB 26%
Share

An integer matrix of size is given. Among the largest elements of the rows, find the smallest one:

Choosing the smallest of the row maximums

Input

The first line contains two positive integers and . Each of the next lines contains integers.

Output

One integer — the smallest of the row maximums.

Note


Examples

Input #1
3 3
1 7 3
4 2 5
9 8 6
Output #1
5
Input #2
1 3
-1 -2 -3
Output #2
-1

Sign in to submit a solution

Signing up is free and takes a minute.