#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long mini = 9999999999;
  long long c;
  long long maxi = 0;
  for (int i = 0; i < n; i++) {
    mini = 9999999999999;
    for (int j = 0; j < m; j++) {
      cin >> c;
      mini = min(mini, c);
    }
    maxi = max(maxi, mini);
  }
  cout << maxi << endl;
  return 0;
}
