Minimum among maximums#9565

Minimum among maximums

1 second
128 megabytes
Hard

You are given a two-dimensional array of size n \cdot m. Find the maximum element in each line, and find the minimum among the maximum elements.

Input

The first line contains two integers and — the number of rows and columns. Then lines of integers are given — the elements of array.

All numbers do not exceed by absolute value.

Output

Print one number — the answer to the problem.

Examples

Example 1

Loading
Loading