#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  int b[n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  for (int i = 0; i < n; i++) {
    b[i] = a[i][0];
    for (int j = 1; j < m; j++) b[i] = min(a[i][j], b[i]);
  }
  int ans = b[0];
  for (int i = 1; i < n; i++) {
    ans = max(b[i], ans);
  }
  cout << ans;
}
