#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
inline S smax(S &l, T r) {
  return l = max(l, (S)r);
}
template <class S, class T>
inline S smin(S &l, T r) {
  return l = min(l, (S)r);
}
const int N = 150;
int c[N][N], mn[N];
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      cin >> c[i][j];
      if (j == 0)
        mn[i] = c[i][j];
      else
        smin(mn[i], c[i][j]);
    }
  int k = 0;
  for (int i = 0; i < n; ++i)
    if (mn[k] < mn[i]) k = i;
  cout << mn[k] << '\n';
  return 0;
}
