#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<vector<long long> > a(n, vector<long long>(m));
  long long ind = 0, maxi = 0;
  for (long long i = 0; i < n; i++) {
    long long mx = (long long)1e18 + 5;
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
      mx = min(a[i][j], mx);
    }
    if (mx > maxi) {
      maxi = mx;
      ind = i;
    }
  }
  long long mn = (long long)1e18 + 5;
  for (long long j = 0; j < m; j++) mn = min(mn, a[ind][j]);
  cout << mn << "\n";
  return 0;
}
