#include <bits/stdc++.h>
int main() {
  int n, m, ans = 0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int now = -1;
    for (int j = 1, x; j <= m; j++) {
      scanf("%d", &x);
      if (now == -1 || now > x) now = x;
    }
    if (ans < now) ans = now;
  }
  printf("%d\n", ans);
  return 0;
}
