#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int d = 1e9 + 1;
    for (int a, j = 1; j <= m; j++) scanf("%d", &a), d = min(d, a);
    ans = max(ans, d);
  }
  printf("%d", ans);
  return 0;
}
