#include <bits/stdc++.h>
int n, m, ar[1010][1010];
int main() {
  int i, j, k, x, y, res;
  while (scanf("%d %d", &n, &m) != EOF) {
    res = 0;
    for (i = 0; i < n; i++) {
      x = (~0U >> 1);
      for (j = 0; j < m; j++) {
        scanf("%d", &ar[i][j]);
        if (ar[i][j] < x) x = ar[i][j];
      }
      if (x > res) res = x;
    }
    printf("%d\n", res);
  }
  return 0;
}
