#include <bits/stdc++.h>
using namespace std;
int a[101][101], n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  int maxmin = 0;
  for (int i = 0; i < n; i++) {
    int min = a[i][0];
    for (int j = 0; j < m; j++)
      if (a[i][j] < min) min = a[i][j];
    if (min > maxmin) maxmin = min;
  }
  cout << maxmin;
  return 0;
}
