#include <bits/stdc++.h>
using namespace std;
int const MAX_N = 210;
long long const LL_INF = 1000000000000000000LL;
int s[MAX_N][MAX_N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &s[i][j]);
  long long mx = -LL_INF;
  for (int i = 0; i < n; i++) {
    long long mn = LL_INF;
    for (int j = 0; j < m; j++) mn = min(mn, s[i][j] + 0LL);
    mx = max(mx, mn);
  }
  cout << mx;
  return 0;
}
