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