#include <bits/stdc++.h>
using namespace std;
const double EPS = (double)1e-9;
const int INF = (int)1e9 + 7;
const long long LINF = 1e18;
const int MXN = (int)1e6 + 10;
const int N = (int)1e3 + 1;
int n, m, ans = -INF;
int mn[MXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) mn[i] = INF;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      int x;
      cin >> x;
      mn[i] = min(x, mn[i]);
    }
  for (int i = 1; i <= n; ++i) ans = max(mn[i], ans);
  cout << ans;
  return 0;
}
