#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n][m];
  vector<long long int> v;
  long long int mn, mx = 0, r = 0;
  long long int it;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> a[i][j];
      v.push_back(a[i][j]);
    }
    mn = *(min_element(v.begin(), v.end()));
    if (mx < mn) {
      mx = max(mx, mn);
      r = i;
    }
    v.clear();
  }
  for (long long int j = 0; j < m; j++) {
    v.push_back(a[r][j]);
  }
  it = min_element(v.begin(), v.end()) - v.begin();
  cout << a[r][it];
  return 0;
}
