#include <bits/stdc++.h>
const int N = 1e6 + 5, MAX = 3e7, MOD = 1e9 + 7;
using namespace std;
int n, m, ans, x;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    int curr = 1e9;
    for (int j = 0; j < m; j++) {
      scanf("%d", &x);
      curr = min(curr, x);
    }
    ans = max(curr, ans);
  }
  printf("%d\n", ans);
}
