#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c, mx = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int mn;
    cin >> mn;
    for (int j = 1; j < m; j++) {
      cin >> c;
      if (c < mn) mn = c;
    }
    if (mx < mn) mx = mn;
  }
  cout << mx;
  return 0;
}
