#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int map[n][m];
  int minc[n];
  for (int i = 0; i < n; ++i) {
    int min = 1000000001;
    for (int j = 0; j < m; ++j) {
      cin >> map[i][j];
      if (map[i][j] < min) min = map[i][j];
    }
    minc[i] = min;
  }
  int max = -1;
  for (int i = 0; i < n; ++i) {
    if (max < minc[i]) {
      max = minc[i];
    }
  }
  cout << max << endl;
  return 0;
}
