#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int m = 0;
  int mi = 1000000001;
  int ans = -1000000001;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    mi = 1000000001;
    for (int j = 0; j < m; ++j) {
      int u = 0;
      scanf("%d", &u);
      mi = min(mi, u);
    }
    ans = max(mi, ans);
  }
  printf("%d\n", ans);
  return 0;
}
