#include <bits/stdc++.h>
using namespace std;
int n, m, a[1001][1001], ans, minim;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++) {
    minim = 1e9;
    for (int j = 1; j <= m; j++) minim = min(minim, a[i][j]);
    ans = max(ans, minim);
  }
  cout << ans;
  return 0;
}
