#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INF = 2e9 + 10;
int n;
int f[200010], s[200010];
inline int lowbit(int x) { return x & -x; }
struct BIT {
  int c[200010];
  void insert(int x, int v) {
    x = n + 2 - x;
    while (x <= n + 1) {
      c[x] = max(c[x], v);
      x += lowbit(x);
    }
  }
  int mmax(int x) {
    int res = -INF;
    x = n + 2 - x;
    while (x) {
      res = max(res, c[x]);
      x -= lowbit(x);
    }
    return res;
  }
} tree;
int main() {
  int a[101][101];
  int n, m;
  cin >> n >> m;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    int mi = 1e9 + 10;
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      mi = min(mi, a[i][j]);
    }
    ans = max(ans, mi);
  }
  cout << ans << endl;
  return 0;
}
