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.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Scanner;

public class CP{
    public static void main(String[] args)throws IOException {
        FastReader in=new FastReader(System.in);
        int i,j,min,temp,r,count;
        int n=in.nextInt();
        int m=in.nextInt();
        int size=1<<m;
        int dp[][]=new int[size][2];
        int pow[]=new int[10];
        pow[0]=1;
        for(i=1;i<10;i++)
            pow[i]=pow[i-1]*2;
        for(i=1;i<size;i++) {
            dp[i][0] = -1;
            dp[i][1]=-1;
        }
        int arr[][]=new int[n][m];
        for(i=0;i<n;i++){
            for(j=0;j<m;j++)
                arr[i][j]=in.nextInt();
        }
        for(i=0;i<n;i++){
            for(j=1;j<size;j++){
                min=Integer.MAX_VALUE;
                temp=j;
                count=0;
                while(temp!=0){
                    r=temp%2;
                    if(r==1)
                        min=Math.min(min,arr[i][count]);
                    if(min<=dp[j][0])
                        break;
                    temp=temp/2;
                    count++;
                }
                if(dp[j][0]<min) {
                    dp[j][0]=min;
                    dp[j][1]=i;
                }
            }
        }
        int narr[]=new int[m];
        int ans=dp[size-1][0],min1;
        int v1=dp[size-1][1]+1;
        int v2=1;
        for(i=0;i<n;i++){
           Integer ind[]=new Integer[m];
           for(j=0;j<m;j++) {
               ind[j] = j;
               narr[j]=arr[i][j];
           }
           Arrays.sort(ind,(a,b)->Integer.compare(narr[a],narr[b]));
           int val=size-1;
           min=Integer.MAX_VALUE;
           for(j=m-1;j>=1;j--){
               val=val-pow[ind[j]];
               min=Math.min(min,arr[i][ind[j]]);
               min1=Math.min(min,dp[val][0]);
               if(ans<min1){
                   ans=min1;
                   v1=i+1;
                   v2=dp[val][1]+1;
               }
           }

        }
        System.out.println(v1+" "+v2);



    }
}
class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    String nextLine() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c != 10 && c != 13; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    char nextChar() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        return (char) c;
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}