#include <bits/stdc++.h>
using namespace std;
const int MX_SZ = 105;
const int INF = 2e+9 + 42;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int cmn = INF;
    for (int j = 1; j <= m; j++) {
      int t;
      cin >> t;
      cmn = min(t, cmn);
    }
    ans = max(ans, cmn);
  }
  cout << ans;
}
