#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int v[101][101], a[101];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> v[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    a[i] = v[i][1];
    for (int j = 1; j <= m; j++) {
      a[i] = min(a[i], v[i][j]);
    }
  }
  cout << *std::max_element(a + 1, a + n + 1) << '\n';
  return 0;
}
