#include <bits/stdc++.h>
using namespace std;
long long c[105][105];
int main() {
  int n, m;
  cin >> n >> m;
  long long maxn = 0;
  for (int i = 1; i <= n; i++) {
    long long minm = 9999999999;
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      minm = min(minm, c[i][j]);
    }
    if (minm != 999999999) maxn = max(maxn, minm);
  }
  cout << maxn;
}
