#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int a[105][105], mn[105];
int n, m;
int main() {
  memset(mn, 0x7f, sizeof mn);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> a[i][j], mn[i] = min(mn[i], a[i][j]);
  int op = 0;
  for (int i = 1; i <= n; ++i) op = max(op, mn[i]);
  cout << op;
  return 0;
}
