#include <bits/stdc++.h>
using namespace std;
int ar[200][200];
int main() {
  int n, m, ans = 0;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int l = 0; l < m; l++) scanf("%d", &ar[i][l]);
  for (int i = 0; i < n; i++) {
    int mn = 2e9;
    for (int l = 0; l < m; l++) mn = min(mn, ar[i][l]);
    ans = max(ans, mn);
  }
  printf("%d\n", ans);
}
