#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, minimum, maximum = 0, t;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    minimum = 1000000001;
    for (int j = 0; j < m; j++) {
      cin >> t;
      minimum = min(t, minimum);
    }
    maximum = max(maximum, minimum);
  }
  cout << maximum;
  return 0;
}
