#include <bits/stdc++.h>
using namespace std;
long long n, m;
const int N = 1e2 + 10;
long long a[N][N], ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
    sort(a[i], a[i] + m);
    ans = max(ans, a[i][0]);
  }
  return cout << ans << endl, 0;
}
