Funny operations

3.8

422 votes
Easy
Problem

In this problem you will be doing some funny operations. These operations are basically a mixture of bitwise operations. You will be given a set of distinct numbers. You have to tell me the maximum value of P that can be obtained in any subset of that array. P is defined below :

    P = (XOR of all of the values in subset) OR (AND of all of the values in subset)

Here XOR , AND and OR are the bitwise operations. If multiple maximum value of P are possible then consider the subset with maximum length.

Input

First line of the input will contain T (no. of test cases). Then every test case will contain two lines. First line will have the value of N then the next line will have N space separated integers of set.

Output

For every test case, print the maximum value of P and then maximum length of the resultant subset.

Constraints

1 <= T <= 10
1 <= N <= 16
0 <= values of set <= 109

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

One of the resultant subset is {1, 2}.

Editor Image

?