#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  cin.ignore();
  vector<vector<unsigned long long>> A;
  vector<unsigned long long> B;
  string s;
  for (size_t i = 0; i < n; i++) {
    getline(cin, s);
    istringstream iss(s);
    int temp;
    while (iss >> temp) {
      B.push_back(temp);
    }
    A.push_back(B);
    B.clear();
  }
  unsigned long long max, ans, min;
  vector<unsigned long long> C;
  for (int i = 0; i < A.size(); i++) {
    min = *min_element(A[i].begin(), A[i].end());
    C.push_back(min);
  }
  max = *max_element(C.begin(), C.end());
  cout << max << endl;
}
