#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long ar[n][m];
  vector<pair<long long, long long>> ans;
  for (long long i = 0; i < n; i++) {
    long long minn = 1e18;
    for (long long j = 0; j < m; j++) {
      cin >> ar[i][j];
      minn = min(minn, ar[i][j]);
    }
    ans.push_back({minn, i});
  }
  sort(ans.begin(), ans.end(), greater<pair<long long, long long>>());
  long long index = ans[0].second;
  long long cost = 1e18;
  for (long long i = 0; i < m; i++) {
    cost = min(cost, ar[index][i]);
  }
  cout << cost;
  return 0;
}
