#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
bool chmin(T1 &a, T2 b) {
  return b < a && (a = b, true);
}
template <class T1, class T2>
bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
using ll = long long;
int c[111][111];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) cin >> c[i][j];
  int ans = 0;
  for (int i = (0); i < (n); i++) {
    int cand = 2e9;
    for (int j = (0); j < (m); j++) chmin(cand, c[i][j]);
    chmax(ans, cand);
  }
  cout << ans << endl;
  return 0;
}
