#include <bits/stdc++.h>
using namespace std;
long long BIG = 10000000000;
signed main() {
  long long n, m;
  cin >> n >> m;
  long long a[n][m];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> a[i][j];
  }
  vector<long long> minimums(n, BIG);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) minimums[i] = min(minimums[i], a[i][j]);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) ans = max(ans, minimums[i]);
  cout << ans;
  return 0;
}
