#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
int main() {
  int n, m, array1[100][100], mini, maxi = -OO, i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      scanf(" %d", &array1[i][j]);
    }
  }
  for (i = 0; i < n; ++i) {
    mini = OO;
    for (j = 0; j < m; ++j) {
      mini = min(mini, array1[i][j]);
    }
    maxi = max(maxi, mini);
  }
  printf("%d", maxi);
  return 0;
}
