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 static java.lang.Math.*;

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;

public class A {
	static PrintWriter pw;
	static StringBuilder sb;
	static int inf = (int) 1e9;
	static long mod = (long) 1e9 + 7;
	static int[][] memo;
	static ArrayList<Integer> primes;
	static ArrayList<Integer>[] arr;
	static int n, k, m;
	static boolean[] vis;
	static HashSet<Integer> hs;
	static HashMap<Integer, Integer> hm;
	static HashSet<Integer> pr;
	static int[] ans, h1, h2;
	static int[] si;
	static int[] in;
	static HashMap<Integer, Integer> factors;
	static int[] fac, a, b;
	static int[] l, r;
	static int[] numc;
	static pair[] ed;
	static ArrayList<Integer>[] np;
	static TreeMap<pair, Integer> tm;
	static char[] h;
	static pair[] mm;

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
		m = Integer.parseInt(st.nextToken());
		memo = new int[n][m];

		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			for (int j = 0; j < m; j++) {
				memo[i][j] = Integer.parseInt(st.nextToken());
			}
		}
		check(memo, 3);
		int s = 0;
		int e = (int) 1e9;
		pair ans = new pair(-1, -1);
		int d = -1;
		while (s <= e) {
			int mid = (s + e) / 2;
			pair p = check(memo, mid);
			if (p.x != -1) {
				s = mid + 1;
				ans = p;
				d = mid;
			} else
				e = mid - 1;
		}
		pw.println(ans.x + " " + ans.y);
		pw.flush();
		pw.close();

	}

	static pair check(int[][] a, int x) {
		ArrayList<pair> arr = new ArrayList<>();
		HashSet<Integer> h = new HashSet<>();
		for (int i = 0; i < a.length; i++) {
			int msk = 0;
			for (int j = 0; j < a[0].length; j++) {
				if (a[i][j] >= x) {
					msk |= 1 << j;
				}
			}
			if (!h.contains(msk)) {
				arr.add(new pair(msk, i));
				h.add(msk);
			}
		}
		for (int i = 0; i < arr.size(); i++) {
			for (int j = i; j < arr.size(); j++) {
				pair p1 = arr.get(i);
				pair p2 = arr.get(j);
				if ((p1.x | p2.x) == pow(2, m) - 1)
					return new pair(p1.y + 1, p2.y + 1);
			}
		}
		return new pair(-1, -1);
	}

	static long dp(int idx, int a) {
		if (idx == m)
			return 1;
		if (memo[idx][a] != -1)
			return memo[idx][a];
		long ans = 0;
		for (int i = 0; i <= a; i++) {
			ans = ((i + 1) * 1l * dp(idx + 1, a - i) + ans) % mod;
		}

		return memo[idx][a] = (int) ((ans) % mod);
	}

	static boolean check(String s, int h, int m) {
		String s2 = reversString(m + "") + ":" + reversString(h + "");
		return s2.equals(com(h, m));

	}

	static String com(int h, int m) {
		String s = "";
		if (h < 10)
			s += "0" + h;
		else {
			s += h;
		}
		s += ":";
		if (m < 10)
			s += "0" + m;
		else {
			s += m;
		}
		return s;
	}

	static String reversString(String x) {
		int y = Integer.parseInt(x);
		if (y < 10)
			return x + "0";
		else
			return x.charAt(1) + "" + x.charAt(0);
	}

	static ArrayList<Integer>[] g;

	static class triple implements Comparable<triple> {
		int x;
		int y;
		int z;
		int w;

		public triple(int a, int b, int c, int d) {
			x = a;
			y = b;
			z = c;
			w = d;
		}

		@Override
		public int compareTo(triple o) {
			// TODO Auto-generated method stub
			return y - o.y;
		}
	}

	static long pow(long a, long e) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res *= a;
			a *= a;
			e >>= 1;
		}
		return res;
	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int k) {
			x = d;
			y = k;
		}

		@Override
		public int compareTo(pair arg0) {
			// TODO Auto-generated method stub
			if (x == arg0.x) {
				return y - arg0.y;
			}
			return x - arg0.x;
		}
	}

}