eolymp
bolt
Try our new interface for solving problems
Problems

Minimum among maximums

Minimum among maximums

Time limit 1 second
Memory limit 128 MiB

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 data

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

All numbers do not exceed 100 by absolute value.

Output data

Print one number — the answer to the problem.

Examples

Input example #1
4 5
1 5 3 2 4
2 4 3 2 2
6 7 8 9 5
8 9 4 2 5
Output example #1
4
Author Жуковський Сергій Станіславович
Source Джерело Серія задач "Абетка програмування"