#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, n, m, sa = 1, l;
  cin >> n >> m;
  vector<long long> c(n, 99999999999);
  for (i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> l;
      c[i] = min(l, c[i]);
    }
  }
  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  cout << c[0] << endl;
}
