#include <bits/stdc++.h>
int main() {
  int n, m, minAvenue, maxStreet, number;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &number);
      if (!j || number < minAvenue) minAvenue = number;
    }
    if (!i || minAvenue > maxStreet) maxStreet = minAvenue;
  }
  printf("%d", maxStreet);
  return 0;
}
