#include <bits/stdc++.h>
using namespace std;
const long long inf = INT_MAX, df = 3e5 + 7, N = 1e6 + 7;
long long i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, opg,
    a[105][105], mn[105], mx;
long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); }
inline long long read() {
  long long x = 0, y = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') y = (ch == '-') ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * y;
}
int main() {
  n = read(), m = read();
  for (long long i = (1); i <= (n); ++i) {
    mn[i] = inf;
    for (long long j = (1); j <= (m); ++j) {
      a[i][j] = read();
      mn[i] = min(mn[i], a[i][j]);
    }
    mx = max(mx, mn[i]);
  }
  return printf("%lld\n", mx), 0;
}
