#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, k = 0;
  cin >> n >> m;
  long long int a[n][m];
  vector<pair<long long int, long long int> > b;
  for (long long int i = 0; i < n; i++) {
    long long int mn = 2000000000;
    for (long long int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] < mn) mn = a[i][j];
    }
    b.push_back(make_pair(mn, i));
  }
  sort(b.begin(), b.end());
  long long int mx;
  for (long long int j = 0; j < m; j++) {
    if (j == 0) {
      mx = a[b[n - 1].second][j];
    } else {
      mx = min(a[b[n - 1].second][j], mx);
    }
  }
  cout << mx;
  return 0;
}
