#include <bits/stdc++.h>
using namespace std;
const int N6 = 1e6 + 6, N3 = 1e3 + 6, oo = 1e9 + 9;
const long long ool = 1e18 + 9;
int n, m;
long long a[N3][N3], mx;
int main() {
  ios_base ::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    long long mn = oo;
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      mn = min(mn, a[i][j]);
    }
    mx = max(mx, mn);
  }
  cout << mx;
  return 0;
}
