#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;
int main() {
  int n, m, x;
  cin >> n >> m;
  int ma = -INF;
  for (int i = 0; i < n; i++) {
    int mi = INF;
    for (int j = 0; j < m; j++) {
      cin >> x;
      mi = min(mi, x);
    }
    ma = max(ma, mi);
  }
  cout << ma << endl;
  return 0;
}
