#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, a, amax, maxmax = -1;
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    amax = INT_MAX;
    for (j = 0; j < m; j++) {
      cin >> a;
      if (a < amax) amax = a;
    }
    if (maxmax < amax) maxmax = amax;
  }
  cout << maxmax;
}
