Problem: You are given n arrays a_1, a_2, ..., a_n; each array consists of exactly m integers. We denote the y-th element of the x-th array as a_{x, y}.

You have to choose two arrays a_i and a_j (1 ≤ i, j ≤ n, it is possible that i = j). After that, you will obtain a new array b consisting of m integers, such that for every k ∈ [1, m] b_k = max(a_{i, k}, a_{j, k}).

Your goal is to choose i and j so that the value of min _{k = 1}^{m} b_k is maximum possible.

Input

The first line contains two integers n and m (1 ≤ n ≤ 3 ⋅ 10^5, 1 ≤ m ≤ 8) — the number of arrays and the number of elements in each array, respectively.

Then n lines follow, the x-th line contains the array a_x represented by m integers a_{x, 1}, a_{x, 2}, ..., a_{x, m} (0 ≤ a_{x, y} ≤ 10^9).

Output

Print two integers i and j (1 ≤ i, j ≤ n, it is possible that i = j) — the indices of the two arrays you have to choose so that the value of min _{k = 1}^{m} b_k is maximum possible. If there are multiple answers, print any of them.

Example

Input


6 5
5 0 3 1 2
1 8 9 1 3
1 2 3 4 5
9 1 0 3 7
2 3 0 6 3
6 4 1 7 0


Output


1 5

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const char IO_MODE = 3;
inline long long ReadInt() {
  long long x = 0, s = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') s = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return s * x;
}
inline void WriteInt(long long x) {
  char c[20];
  if (!x) {
    putchar('0');
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  int i = 0;
  while (x > 0) c[++i] = x % 10, x /= 10;
  while (i) putchar(c[i--] + 48);
}
template <typename T>
inline void out(T x) {
  if (IO_MODE & 1)
    WriteInt(x);
  else if (typeid(x) == typeid(int))
    printf("%i", x);
  else
    printf("%lld", (long long)x);
}
template <typename T, typename... Args>
inline void out(T x, Args... args) {
  out(x);
  putc(' ', stdout);
  out(args...);
}
template <typename T>
inline void in(T &x) {
  if (IO_MODE & 2)
    x = ReadInt();
  else if (typeid(x) == typeid(int))
    scanf("%i", &x);
  else if (typeid(x) == typeid(long long))
    scanf("%lld", &x);
}
template <typename T, typename... Args>
inline void in(T &x, Args &...args) {
  in(x);
  in(args...);
}
int aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, mm, nn, oo, pp, qq, rr, ss, tt,
    uu, vv, ww, xx, yy, zz;
int tc;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug &operator<<(const c &) {
    return *this;
  }
};
int n, m;
int A[300100][9], B[300100][9];
int cur[300100];
int res[1 << 9];
vector<pair<int, pair<int, int> > > v[9];
int main() {
  in(n, m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) in(A[i][j]);
    for (int j = 0; j < m; j++) {
      int mask = 0;
      for (int k = 0; k < m; k++)
        if (A[i][j] > A[i][k]) mask |= 1 << k;
      v[j].push_back(make_pair(A[i][j], make_pair(mask, i)));
    }
  }
  for (int j = 0; j < m; j++) sort(v[j].begin(), v[j].end());
  memset(res, -1, sizeof res);
  pair<int, pair<int, int> > ans = {-1000000007, {-1000000007, -1000000007}};
  int tot = m * n;
  while (tot--) {
    pair<int, int> mxj = {-1000000007, -1000000007};
    for (int j = 0; j < m; j++)
      if (v[j].size()) mxj = max(mxj, make_pair(v[j].back().first, j));
    int jj = mxj.second;
    pair<int, pair<int, int> > x = v[jj].back();
    v[jj].pop_back();
    int val = x.first;
    int mask = x.second.first;
    int i = x.second.second;
    debug() << " ["
            << "mxj"
               ": "
            << (mxj)
            << "] "
               " ["
            << "x"
               ": "
            << (x) << "] ";
    if (res[mask] != -1) {
      ans = max(ans, make_pair(val, make_pair(i, res[mask])));
    } else if (!mask) {
      ans = max(ans, make_pair(val, make_pair(i, i)));
    }
    res[cur[i] |= 1 << jj] = i;
  }
  debug() << " ["
          << "ans"
             ": "
          << (ans) << "] ";
  if (ans.second.second < 0)
    printf("1 1\n");
  else
    cout << ans.second.second + 1 << " " << ans.second.first + 1 << endl;
}