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