#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, Max = 0, Min = 1000000007, n, m, a;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> Min;
    for (j = 0; j < m - 1; j++) {
      cin >> a;
      Min = min(a, Min);
    }
    Max = max(Max, Min);
  }
  cout << Max;
  return 0;
}
