#include <bits/stdc++.h>
using namespace std;
int t[110][110];
int miny[110];
int main() {
  int mini = 1000000001, n, m, wyn = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &t[i][j]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) mini = min(mini, t[i][j]);
    miny[i] = mini;
    mini = 1000000001;
  }
  for (int i = 1; i <= n; i++) wyn = max(wyn, miny[i]);
  printf("%d", wyn);
}
