#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, sol;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    long long s = 9999999999999, x;
    for (j = 1; j <= m; ++j) {
      cin >> x;
      s = min(s, x);
    }
    if (sol < s) sol = s;
  }
  cout << sol;
  return 0;
}
