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.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().run(in, out);
        out.close();
    }

    public static long mod = 17352642619633L;

    int N;
    int M;
    int[][] a;
    void run(FastScanner in, PrintWriter out) {
        N = in.nextInt();
        M = in.nextInt();
        a = new int[N][M+1];
        for (int i = 0; i < N; i++) {
            a[i][M] = i+1;
            for (int j = 0; j < M; j++) {
                a[i][j] = in.nextInt();
            }
        }

        int lo = 0;
        int hi = 1_000_000_001;

        int[] ret = null;
        while (lo < hi) {
            int m = (lo+hi)>>1;
            int[] k = canForm(m);
            if (k != null) {
                ret = k;
                lo = m+1;
            } else {
                hi = m;
            }
        }

        out.println(ret[0] + " " + ret[1]);
    }

    int[] b = new int[1<<8];
    int[] canForm(int m) {
        Arrays.fill(b, 0);
        b[0] = 1;
        for (int i = 0; i < N; i++) {
            // look for complement
            int k = 0;
            int compK = 0;
            int mask = 0;
            for (int j = 0; j < M; j++) {
                if (a[i][j] >= m) {
                    k |= (1<<mask);
                } else {
                    compK |= (1<<mask);
                }
                mask++;
            }

            if (b[compK] != 0) return new int[] {b[compK], a[i][M]};

            fill(b, k, 0, a[i][M]);
        }

        return null;
    }

    int cnt = 0;
    void fill(int[] b, int k, int i, int id) {
        if (i == M+1) return;
        if (b[k] != 0 && b[k] != id) return;
        b[k] = id;

        fill(b, k&(~(1<<i)), i+1, id);

        if ((k&(1<<i)) > 0) {
            fill(b, k, i+1, id);
        }
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}