#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p;
  scanf("%d %d", &n, &m);
  int Max = INT_MIN;
  for (int i = 1; i <= n; i++) {
    int Min = INT_MAX;
    for (int i = 1; i <= m; i++) {
      scanf("%d", &p);
      Min = min(Min, p);
    }
    Max = max(Max, Min);
  }
  printf("%d", Max);
}
