#include <bits/stdc++.h>
using namespace std;
int const N = 100 + 2, MOD = 1e9 + 7;
int a[N][N], n, m;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 0; j < (int)(m); ++j) cin >> a[i][j];
  int mx = -1;
  for (int i = 0; i < (int)(n); ++i) {
    int mn = 1e9 + 1;
    for (int j = 0; j < (int)(m); ++j) mn = min(mn, a[i][j]);
    mx = max(mx, mn);
  }
  cout << mx << endl;
}
