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