#include <bits/stdc++.h>
using namespace std;
const int dim = 100;
int a[dim][dim], m, n;
void citire() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
}
int cautare() {
  int min1, min2, max = 0;
  for (int i = 1; i <= n; i++) {
    min1 = a[i][1];
    for (int j = 2; j <= m; j++) {
      if (a[i][j] < min1) min1 = a[i][j];
    }
    if (min1 > max) max = min1;
  }
  return max;
}
int main() {
  citire();
  cout << cautare();
  return 0;
}
