#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[105][105];
  for (int i = 0; i < n; i++) {
    int min = 1000000000;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] < min) min = a[i][j];
    }
    a[i][m] = min;
  }
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (a[i][m] > max) max = a[i][m];
  }
  cout << max;
}
