Virat decides to go on date with Anushka. He doesn't want to go to an expensive restaurant. Anushka is a girl with high taste, she prefers elite places.
A city consists of n streets and m avenues.There is exactly one restaurant on the intersection of each street and avenue. The streets are numbered with integers from 1 to n and the avenues are numbered with integers from 1 to m. The cost of dinner in the restaurant at the intersection of the i-th street and the j-th avenue is cij.
Virat and Anushka decide to choose the restaurant in the following way. Firstly Anushka chooses the street to dinner and then Virat chooses the avenue.Anushka and Virat makes their choice optimally: Anushka wants to maximize the cost of the dinner, Virat wants to minimize it. Anushka takes into account that Virat wants to minimize the cost of the dinner. Find the cost of the dinner for the couple in love.
Input Format
The first line contains two integers n, m (1 ≤ n, m ≤ 100) — the number of streets and avenues.
Each of the next n lines contains m integers cij (1 ≤ cij ≤ 109) — the cost of the dinner in the restaurant on the intersection of the ith street and the jth avenue.
Output Format
Print the only integer a — the cost of the dinner for Virat and Anushka.