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>
#pragma GCC optimize("Ofast")
namespace FastIO {
struct Reader {
 private:
  FILE* file;
  std::vector<char> buffer;
  int pos;
  bool was;
  void read() {
    if (!buffer.empty()) {
      buffer.resize(fread(&buffer[0], 1, (int)buffer.size(), file));
      pos = 0;
    }
  }

 public:
  Reader(FILE* file_ = stdin, const int size_ = 1 << 16)
      : file(file_), buffer(size_, '\0'), pos(size_), was(true) {}
  operator bool() const { return was; }
  char getChar() {
    if (pos == (int)buffer.size()) {
      read();
    }
    if (pos == (int)buffer.size()) {
      was = false;
      return EOF;
    } else {
      was = true;
      return buffer[pos++];
    }
  }
  std::string getStr() {
    char c = ' ';
    while (std::isspace(c)) {
      c = getChar();
    }
    std::string answ;
    while (c != EOF && !std::isspace(c)) {
      answ.push_back(c);
      c = getChar();
    }
    was = !answ.empty();
    return answ;
  }
  std::string getLine() {
    char c = '\n';
    while (c == '\n') {
      c = getChar();
    }
    std::string answ;
    while (c != '\n' && c != EOF) {
      answ.push_back(c);
      c = getChar();
    }
    was = !answ.empty();
    return answ;
  }
  template <typename T>
  T getInt() {
    char c = '?';
    while (!(c == '-' || ('0' <= c && c <= '9') || c == EOF)) {
      c = getChar();
    }
    bool positive = true;
    if (c == '-') {
      positive = false;
      c = getChar();
    }
    T answ(0);
    bool flag = false;
    while ('0' <= c && c <= '9') {
      flag = true;
      (answ *= 10) += (c - '0');
      c = getChar();
    }
    was = flag;
    return positive ? answ : -answ;
  }
  template <typename T>
  T getReal() {
    bool flag = false;
    char c = '?';
    while (!(c == '-' || ('0' <= c && c <= '9') || c == EOF)) {
      c = getChar();
    }
    bool positive = (c != '-');
    if (c == '-') {
      c = getChar();
    }
    long long first = 0;
    while ('0' <= c && c <= '9') {
      flag = true;
      (first *= 10) += (c - '0');
      c = getChar();
    }
    was = flag;
    if (c != '.') {
      return T(positive ? first : -first);
    }
    c = getChar();
    long long second = 0, pow = 1;
    while ('0' <= c && c <= '9') {
      (second *= 10) += (c - '0');
      c = getChar();
      pow *= 10;
    }
    T answ = first + (T)second / (T)pow;
    return positive ? answ : -answ;
  }
};
Reader& operator>>(Reader& reader, char& c) {
  return c = reader.getChar(), reader;
}
Reader& operator>>(Reader& reader, std::string& s) {
  return s = reader.getStr(), reader;
}
template <class T>
typename std::enable_if<std::is_floating_point<T>::value, Reader&>::type
operator>>(Reader& reader, T& t) {
  return t = reader.getReal<T>(), reader;
}
template <class T>
typename std::enable_if<std::is_integral<T>::value, Reader&>::type operator>>(
    Reader& reader, T& t) {
  return t = reader.getInt<T>(), reader;
}
template <class T>
Reader& operator>>(Reader& reader, std::vector<T>& vec) {
  for (auto& it : vec) {
    reader >> it;
  }
  return reader;
}
struct Writer {
 private:
  FILE* file;
  std::vector<char> buffer;
  int pos;
  int defaultPrecision, defaultWidth;
  char defaultFill;

 public:
  Writer(FILE* file_ = stdout, const int size_ = 1 << 16)
      : file(file_),
        buffer(size_, '\0'),
        pos(0),
        defaultPrecision(6),
        defaultWidth(0),
        defaultFill(' ') {}
  ~Writer() { flush(); }
  void flush() { putChar(EOF); }
  void setprecision(int precision) { defaultPrecision = precision; }
  void setw(int width) { defaultWidth = width; }
  void setfill(char fill) { defaultFill = fill; }
  int getPrecision() const { return defaultPrecision; }
  int getWidth() const { return defaultWidth; }
  char getFill() const { return defaultFill; }
  void putChar(char c) {
    if (pos == (int)buffer.size() || c == EOF) {
      fwrite(&buffer[0], 1, pos, file);
      pos = 0;
    }
    if (c != EOF) {
      buffer[pos++] = c;
    }
  }
  void putStr(const std::string& s) {
    for (auto it : s) putChar(it);
  }
  template <typename T>
  void putInt(T value, int width = 0, char fill = ' ') {
    bool positive = !(value < 0);
    if (value < 0) {
      value = -value;
    }
    char buf[24];
    int p = 0;
    do {
      buf[p++] = char(value % 10 + '0');
      value /= 10;
    } while (value > 0);
    if (!positive) {
      buf[p++] = '-';
    }
    while (p < width) buf[p++] = fill;
    while (p > 0) putChar(buf[--p]);
  }
  template <typename T>
  void putReal(T value, int precision = 6, int width = 0, char fill = ' ') {
    putInt((long long)value, width - precision - 1, fill);
    value = std::abs(value - (long long)value);
    if (precision == 0) {
      return;
    }
    putChar('.');
    while (precision >= 6) {
      value *= 1000000;
      putInt((int)value, 6, '0');
      value -= (int)value;
      precision -= 6;
    }
    while (precision >= 3) {
      value *= 1000;
      putInt((int)value, 3, '0');
      value -= (int)value;
      precision -= 3;
    }
    while (precision >= 1) {
      value *= 10;
      putInt((int)value, 1, '0');
      value -= (int)value;
      precision -= 1;
    }
  }
};
Writer& operator<<(Writer& writer, const char c) {
  return writer.putChar(c), writer;
}
Writer& operator<<(Writer& writer, const std::string& s) {
  return writer.putStr(s), writer;
}
template <class T>
typename std::enable_if<std::is_floating_point<T>::value, Writer&>::type
operator<<(Writer& writer, const T& t) {
  writer.putReal(t, writer.getPrecision(), writer.getWidth(), writer.getFill());
  return writer;
}
template <class T>
typename std::enable_if<std::is_integral<T>::value, Writer&>::type operator<<(
    Writer& writer, const T& t) {
  writer.putInt(t, writer.getWidth(), writer.getFill());
  return writer;
}
}  // namespace FastIO
template <typename X, typename Y>
X& remax(X& x, Y y) {
  return x = (y > x ? y : x);
}
const int N = 300300, M = 8;
int n, m, arr[N][M], who[1 << M], answI, answJ;
bool find(int min) {
  std::fill(who, who + (1 << M), 0);
  for (int i = 1; i <= n; i++) {
    int mask = 0;
    for (int j = 0; j < m; j++) {
      mask |= (arr[i][j] >= min) << j;
    }
    who[mask] = i;
  }
  for (int fi = 0; fi < (1 << m); fi++) {
    for (int se = 0; se < (1 << m); se++) {
      if ((fi | se) == (1 << m) - 1 && who[fi] && who[se]) {
        answI = who[fi];
        answJ = who[se];
        return true;
      }
    }
  }
  return false;
}
int main() {
  FastIO::Reader cin;
  FastIO::Writer cout;
  int low = 0, high = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      remax(high, arr[i][j] + 1);
    }
  }
  while (high - low > 1) {
    int mid = (low + high) / 2;
    if (find(mid)) {
      low = mid;
    } else {
      high = mid;
    }
  }
  find(low);
  cout << answI << ' ' << answJ << '\n';
  return 0;
}