#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(50);
  long long n, m, mi = 1000000000000000, ans = 0;
  cin >> n >> m;
  vector<vector<long long>> v(n, vector<long long>(m, 0));
  for (int i = 0; i < n; i++) {
    mi = 1000000000000000;
    for (int j = 0; j < m; j++) {
      cin >> v[i][j];
      mi = min(mi, v[i][j]);
    }
    ans = max(mi, ans);
  }
  cout << ans;
}
