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;
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename T0>
void read(T &x, T0 &y) {
  cin >> x >> y;
}
template <typename T, typename T0, typename T1>
void read(T &x, T0 &y, T1 &z) {
  cin >> x >> y >> z;
}
template <typename T, typename T0, typename T1, typename T2>
void read(T &x, T0 &y, T1 &z, T2 &w) {
  cin >> x >> y >> z >> w;
}
template <typename T, typename T0>
void read(pair<T, T0> &p) {
  cin >> p.first >> p.second;
}
template <typename T>
void read(vector<T> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    read(oneD[i]);
  }
}
template <typename T>
void read(T oneD[], int n) {
  for (long long i = 0; i < n; i++) {
    read(oneD[i]);
  }
}
template <typename T>
void write(T &x) {
  cout << x << " ";
}
template <typename T, typename T0>
void write(T &x, T0 &y) {
  cout << x << " " << y << "\n";
}
template <typename T, typename T0, typename T1>
void write(T &x, T0 &y, T1 &z) {
  cout << x << " " << y << " " << z << "\n";
}
template <typename T, typename T0, typename T1, typename T2>
void write(T &x, T0 &y, T1 &z, T2 &w) {
  cout << x << " " << y << " " << z << " " << w << "\n";
}
template <typename T, typename T0>
void write(pair<T, T0> &p) {
  write(p.first);
  write(p.second);
  cout << "\n";
}
template <typename T>
void write(vector<T> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    write(oneD[i]);
  }
  cout << "\n";
}
template <typename T>
void write(T oneD[], int n) {
  for (long long i = 0; i < n; i++) {
    write(oneD[i]);
  }
  cout << "\n";
}
template <typename T, typename T0>
void write(map<T, T0> &mpp) {
  for (auto it : mpp) {
    write(it.first);
    cout << ": ";
    write(it.second);
    cout << "\n";
  }
  cout << "\n";
}
vector<long long> sieve;
void Sieve(int N) {
  const long long maxn = N;
  sieve.resize(maxn);
  for (long long(i) = 0; (i) < (maxn); ++(i)) sieve[i] = i;
  sieve[1] = -1;
  sieve[0] = -1;
  for (long long(i) = 2; (i) <= (maxn); (i) += (1))
    if (i == sieve[i])
      for (long long j = 2 * i; j < maxn; j += i)
        if (sieve[j] == j) sieve[j] = i;
}
long long extended_GCD(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = extended_GCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
long long power(long long a, long long b, long long m = 1000000007) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod = 1000000007) {
  long long x, y;
  extended_GCD(a, mod, x, y);
  if (x < 0) x += mod;
  return x;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > A(n, vector<int>(m));
  vector<pair<int, int> > maskMax(1 << m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> A[i][j];
    }
    for (int mask = 0; mask < 1 << m; ++mask) {
      pair<int, int> cur = {INT_MAX, -1};
      for (int j = 0; j < m; ++j) {
        if ((mask >> j) & 1 == 1) {
          cur = min(cur, {A[i][j], i});
        }
      }
      maskMax[mask] = max(maskMax[mask], cur);
    }
  }
  int s = 0, e = 1e9;
  int ans = -1, resI = -1, resJ = -1;
  while (s <= e) {
    int mid = s + e >> 1;
    bool possible = false;
    int curI = -1, curJ = -1;
    for (int i = 0; i < n; ++i) {
      int mask = 0;
      for (int j = 0; j < m; ++j) {
        if (A[i][j] < mid) {
          mask |= 1 << j;
        }
      }
      if (maskMax[mask].first >= mid) {
        possible = true;
        curI = i;
        curJ = maskMax[mask].second;
        if (curJ == -1) curJ = i;
        break;
      }
    }
    if (possible) {
      s = mid + 1;
      ans = mid;
      resI = curI;
      resJ = curJ;
    } else {
      e = mid - 1;
    }
  }
  cout << resI + 1 << " " << resJ + 1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}