Maximise It

4.2

5 votes
Problem

Your time is precious and I'm also too lazy to say the story. So, directly go to the question.

You are given an array A . you have to print i and j such that (A[i] & A[j]) | (~A[i] & ~A[j]) ( Here "&" is bitwiseAND  , "|" is bitwiseOR and "~" is bitwiseNOT ) is maximum possible and i<j . If more than one solution exist then choose i and j such that pair (i, j) is lexicographically smallest pair. 

Input

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.

First line of each testcase contains N - Size of array . Next line contains N integers where ith integer represent A[i]. (1 based indexing)

Output

For each testcase print a single line containing two integers i and j such that (A[i] & A[j]) | (~A[i] & ~A[j]) is maximum possible and i<j . If more than one solution exist then choose i and j such that pair (i, j) is lexicographically smallest pair. 

Constrains

1 <= T <= 10

2 <= N <= 105

0 <= A[i] <= 109

Sample Input
1
4
8 5 4 8
Sample Output
1 4
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?