#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, i, j, test, ans1 = 0, ans, p;
  long long a[100009];
  cin >> t >> n;
  for (i = 1; i <= t; i++) {
    test = 100000000000;
    for (j = 1; j <= n; j++) {
      cin >> ans;
      test = min(test, ans);
    }
    ans1 = max(test, ans1);
  }
  cout << ans1 << endl;
  return 0;
}
