#include <bits/stdc++.h>
using namespace std;
int n, m, a[101][101];
int main() {
  cin >> n >> m;
  int mn, mx = 0;
  for (int i = 1; i <= n; ++i) {
    mn = 1e9;
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      if (mn > a[i][j]) {
        mn = a[i][j];
      }
    }
    if (mx < mn) {
      mx = mn;
    }
  }
  cout << mx;
  return 0;
}
