#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int maxc = 0;
  for (int i = 0; i < n; i++) {
    int minc = INF;
    for (int j = 0; j < m; j++) {
      int cij;
      scanf("%d", &cij);
      if (minc > cij) minc = cij;
    }
    if (maxc < minc) maxc = minc;
  }
  printf("%d\n", maxc);
  return 0;
}
