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:
/**
 * https://codeforces.com/problemset/problem/1288/D
 
    1 2 3 4 5
1:  5 0 3 1 2       =>      1 0 1 1 1
2:  2 3 0 6 3       =>      1 1 0 1 1
    9 1 0 3 7       =>      1 1 0 1 1
2^m-1

2^m m = 8 => 2^8

O(N*M + 4^M)

log(MAX)*(N*M + 4^M)

N = 3e5 * 8 ~= 2.4*10^6
    4^M     ~= 65 *10^3

b = calculate(a_i, a_j)
min(b) >= x
    tang x
    
binary search
 */

import java.util.Scanner;
public class MinimaxProblem {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int max = 0, min = 0;
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = sc.nextInt();
                if (arr[i][j] > max) {
                    max = arr[i][j];
                }
                if (arr[i][j] < min) {
                    min = arr[i][j];
                }
            }
        }
        Position result = new Position(0,0);
        Position seleclted = new Position(-1, -1);
        while (min <= max) {
            int x = min + (max - min) / 2;
            if (acceptable(arr, n, m, x, seleclted)) {
                min = x + 1;
                result.row1 = seleclted.row1;
                result.row2 = seleclted.row2;
            }
            else {
                max = x - 1;
            }
        }
        System.out.println(result.row1 + " " + result.row2);
    }
    private static boolean acceptable(int[][] arr, int n, int m, int x, Position selected) {
        boolean accepted = false;
        // bitmask
        int size = 1 << m;
        boolean[] bitmask = new boolean[size];
        int[] pos = new int[size];
        for(int i = 0; i < n; i++) {
            int p = 1;
            int bit_idx = 0;
            for (int j = 0; j < m; j++) {
                int b = (arr[i][j] >= x) ? 1 : 0;
                bit_idx += b * p;
                p <<= 1;
            }
            bitmask[bit_idx] = true;
            pos[bit_idx] = i;
        }
        // check 2^M states.
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                if (bitmask[i] && bitmask[j] && ((i | j) == size - 1)) {
                    selected.row1 = pos[i] + 1;
                    selected.row2 = pos[j] + 1;
                    accepted = true;
                    break;
                }
            }
        }
        return accepted;
    }
}
class Position {
    int row1, row2;
    Position(int row1, int row2) {
        this.row1 = row1;
        this.row2 = row2;
    }
}