#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int a[n + 2][m + 2];
  int b[n + 2];
  for (int i = 0; i <= n; i++) b[i] = 1000000007;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      b[i - 1] = min(b[i - 1], a[i][j]);
    }
  }
  sort(b, b + n);
  cout << b[n - 1];
}
