#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    int c[100][100] = {0};
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cin >> c[i][j];
      }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      int a = 1000000001;
      for (int j = 0; j < m; ++j) {
        a = min(a, c[i][j]);
      }
      ans = max(ans, a);
    }
    cout << ans << endl;
  }
  return 0;
}
