#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n, m, i, j, k, a, mac, mic;
  cin >> n >> m;
  mac = 0;
  for (i = 0; i < n; i++) {
    mic = 100000000006;
    for (j = 0; j < m; j++) {
      cin >> a;
      if (a < mic) mic = a;
    }
    if (mic > mac) mac = mic;
  }
  cout << mac << endl;
  return 0;
}
