#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  cin >> n >> m;
  long int a[110][110], colmax = 0;
  for (int i = 0; i < n; i++) {
    long int rowmin = 1000000009;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] < rowmin) rowmin = a[i][j];
    }
    if (rowmin > colmax) colmax = rowmin;
  }
  cout << colmax;
  return 0;
}
