using System;
using System.Linq;
namespace consoleapp
{
class Program
{
static void Main()
{
int max = 0, ro = 0, c = 0;
int m, n;
m = Convert.ToInt32(Console.ReadLine());
n = Convert.ToInt32(Console.ReadLine());
double[,] A = new double[m,n];
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
A[m, n] = Convert.ToDouble(Console.ReadLine());
if (m == n || m > n)
if (A[m, n] > max)
{
A[m,n] = max;
ro = m;
c = n;
}
}
}
Console.WriteLine(max);
}
}
}