#include <bits/stdc++.h>
using namespace std;
int a[100 + 10][100 + 10];
vector<int> v;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 1000000000;
  for (int i = 1; i <= n; i++) {
    ans = 1000000000;
    for (int j = 1; j <= m; j++) {
      ans = min(ans, a[i][j]);
    }
    v.push_back(ans);
  }
  ans = 0;
  for (int i = 0; i < v.size(); i++) {
    ans = max(ans, v[i]);
  }
  cout << ans << endl;
}
