#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> v[n + 2];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      long long c;
      cin >> c;
      v[i].push_back(c);
    }
  }
  for (long long i = 0; i < n; i++) {
    sort(v[i].begin(), v[i].end());
  }
  long long ans = -1;
  for (long long i = 0; i < n; i++) {
    if (v[i][0] > ans) ans = v[i][0];
  }
  cout << ans << endl;
  return 0;
}
