#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int ar[n][m];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> ar[i][j];
    }
  }
  vector<int> ans;
  for (int i = 0; i < n; ++i) {
    int mi = INT_MAX;
    for (int j = 0; j < m; ++j) {
      mi = min(mi, ar[i][j]);
    }
    ans.push_back(mi);
  }
  cout << *max_element(ans.begin(), ans.end());
  return 0;
}
