#include <bits/stdc++.h>
using namespace std;
int n, m, sa[100][100];
int x = 1;
int mr = 10000000000;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> sa[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (mr > sa[i][j]) {
        mr = sa[i][j];
      }
    }
    if (mr > x) {
      x = mr;
    }
    mr = 10000000000;
  }
  cout << x;
}
