#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1007;
int p[Maxn];
int main() {
  ios_base::sync_with_stdio(0);
  memset(p, 127, sizeof p);
  int n, m, ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int c, j = 0; j < m; j++) cin >> c, p[i] = min(p[i], c);
  for (int i = 0; i < n; i++) ans = max(ans, p[i]);
  cout << ans << endl;
  return 0;
}
