#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k = 0, p, n, m, min;
  cin >> n >> m;
  long long int a[n];
  for (i = 0; i < n; i++) {
    min = 1000000000;
    for (j = 0; j < m; j++) {
      cin >> p;
      if (p <= min) min = p;
    }
    a[k] = min;
    k++;
  }
  long long int max = -99999;
  for (i = 0; i < k; i++)
    if (a[i] >= max) max = a[i];
  cout << max << endl;
  return 0;
}
