#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b, m, d;
  cin >> n >> m;
  int maxn = 0;
  for (int i = 1; i <= n; i++) {
    int minn = 1e9;
    for (int j = 1; j <= m; j++) {
      cin >> d;
      minn = min(minn, d);
    }
    maxn = max(maxn, minn);
  }
  cout << maxn << endl;
}
