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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Problem80D {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        StringTokenizer info = new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(info.nextToken());
        int m = Integer.parseInt(info.nextToken());

        int[][] a = new int[n][m];
        for (int i = 0; i < n; i++) {
            StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
            for (int j = 0; j < m; j++) {
                a[i][j] = Integer.parseInt(tokenizer.nextToken());
            }
        }
        int min = binarySearch(a);
        Pair answer = getAnswer(a, min);
        writer.println((answer.a + 1) + " " + (answer.b + 1));

        reader.close();
        writer.close();
    }
    public static int binarySearch(int[][] a) {
        int low = 0;
        int high = 1_000_000_005;
        while (low < high) {
            if (high - low == 1) {
                if (possible(a, high)) {
                    return high;
                } else {
                    return low;
                }
            }
            int mid = (high - low) / 2 + low;
            if (possible(a, mid)) {
                low = mid;
            } else {
                high = mid - 1;
            }
        }
        return low;
    }
    public static boolean possible(int[][] a, int x) {
        return getAnswer(a, x) != null;
    }
    public static Pair getAnswer(int[][] a, int x) {
        int n = a.length;
        int m = a[0].length;
        int[] dp = new int[1 << m];
        Arrays.fill(dp, -1);
        for (int i = 0; i < n; i++) {
            int value = 0;
            for (int j = 0; j < m; j++) {
                if (a[i][j] >= x) {
                    value |= (1 << j);
                }
            }
            dp[value] = i;
        }
        for (int i = dp.length - 1; i >= 0; i--) {
            for (int j = 0; j < m && dp[i] == -1; j++) {
                dp[i] = dp[i | (1 << j)];
            }
        }
        for (int i = 0; i < n; i++) {
            int value = 0;
            for (int j = 0; j < m; j++) {
                if (a[i][j] >= x) {
                    value |= (1 << j);
                }
            }
            if (dp[((1 << m) - 1) ^ value] != -1) {
                return new Pair(i, dp[((1 << m) - 1) ^ value]);
            }
        }
        return null;
    }
    static class Pair {
        int a, b;
        public Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
        public String toString() {
            return "[" + a + " " + b + "]";
        }
    }
}