#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  int ma = -1;
  for (int i = 0; i < n; i++) {
    int mi = 2000000000;
    for (int j = 0; j < m; j++) {
      int tmp;
      scanf("%d", &tmp);
      mi = min(mi, tmp);
    }
    ma = max(ma, mi);
  }
  printf("%d\n", ma);
  return 0;
}
