#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int r, c;
  cin >> r >> c;
  int M[r];
  memset((M), (0), sizeof(M));
  for (int i = 0; i < r; ++i) {
    M[i] = 1e9 + 10;
  }
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      int t;
      cin >> t;
      M[i] = min(M[i], t);
    }
  }
  int ans = 0;
  for (int i = 0; i < r; ++i) {
    ans = max(ans, M[i]);
  }
  cout << ans << endl;
  return 0;
}
