Problem Statement:
Max is a mad thief, who used to steal from the poor people to pay his taxes! But recently he decided not to pay anything anymore, he just wants to steal things and hide them in his 2 safes. Max knows some number theory, so he made a way to encrypt the 2 keys of the 2 safes (each safe has different key).

As a police officer, you chased Max and caught him, but Max now refuses to give you the keys. You made a deal with Max, that he will explain how to get the keys, and you will release him after 1000000 years!

The way to get the keys: You are given n (2 ≤ n ≤ 100) distinct integers x1, x2, x3 .... xn (0 ≤ xi ≤ 106). And an integer m (10 ≤ m ≤ 106).

Find the pair of numbers (k1, k2) from all xi's for which the value (k1 * k2) mod m is maximized, where k1 < k2. Then the keys are just the two numbers k1 and k2.


Input Format:
Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 60). Followed by T test cases, each test case consists of two lines, the first line contains m and n separated by space as described above, the second line contains n integers indicates the numbers x1, x2, x3 .... xn separated by a space.


Output Format:
For each test case, print one line containing two ordered integers k1 and k2 (k1 < k2) separated by space. If there are multiple pairs that satisfy the conditions, print the pair with the lowest k1, if there are still multiple pairs, print the pair with the lowest k2.


Sample Input:
3 17 5 56 88 108 150 38 211 10 2146 1275 894 2163 1723 1479 1304 1498 1296 2317 5007 3 99998 99997 99999


Sample Output:
108 150 2163 2317 99998 99999





Added by: feras_kassar
Added at: 2014-07-26 09:00:04 UTC
Time Limit: 3 seconds
Partial score: No
Source:Damascus University First Training Contest 2014