#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  int b[n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  int min;
  for (int i = 0; i < n; i++) {
    min = pow(10, 9);
    for (int j = 0; j < m; j++) {
      if (a[i][j] < min) min = a[i][j];
    }
    b[i] = min;
  }
  cout << *max_element(b, b + n);
}
