#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[200][200];
  int n, m, ok = 1000000000, ans = 0;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    ok = 1000000000;
    for (int j = 0; j < m; j++) {
      scanf("%d", &arr[i][j]);
      if (ok > arr[i][j]) ok = arr[i][j];
    }
    ans = max(ans, ok);
  }
  printf("%d", ans);
  return 0;
}
