#include <bits/stdc++.h>
int solve(int n, int m, std::vector<int> const& costs) {
  int chosen_row_minimum = -1;
  for (int i = 0; i < n; ++i) {
    auto min =
        std::min_element(costs.cbegin() + i * m, costs.cbegin() + i * m + m);
    if (*min > chosen_row_minimum) {
      chosen_row_minimum = *min;
    }
  }
  return chosen_row_minimum;
}
int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> costs;
  costs.reserve(n * m);
  costs.insert(costs.end(), std::istream_iterator<int>(std::cin),
               std::istream_iterator<int>());
  assert(n * m == (int)costs.size());
  int chosen_row_minimum = solve(n, m, costs);
  printf("%d\n", chosen_row_minimum);
  return 0;
}
