#include <bits/stdc++.h>
using namespace std;
int cmp(int x, int y) { return x > y; }
int main() {
  int i, j, n, m, min = 0x7fffffff, k[101], a[101][101];
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] < min) {
        min = a[i][j];
        k[i] = min;
      }
    }
    min = 0x7fffffff;
  }
  sort(k + 1, k + n + 1, cmp);
  cout << k[1];
}
