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