#include <bits/stdc++.h>
using namespace std;
const int MAX = 105;
int n, m;
long long a[MAX][MAX];
long long Mi[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++)
      ;
  for (int i = 0; i < n; i++) {
    long long M = 1e9 + 9;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] < M) M = a[i][j];
    }
    Mi[i] = M;
  }
  sort(Mi, Mi + n);
  reverse(Mi, Mi + n);
  cout << Mi[0];
}
