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