Chef is playing a game with his childhood friend. He gave his friend a list of N numbers named $a_1, a_2 ....  a_N$ (Note: All numbers are unique). Adjust the numbers in the following order:
$(i)$ swap every alternate number with it's succeeding number (If N is odd, do not swap the last number i.e. $a_N$ ).
$(ii)$ add %3 of every number to itself.
$(iii)$ swap the ith number and the (N-i-1) th number.
After this, Chef will give a number to his friend and he has to give the nearest greater and smaller number to it.
If there is no greater or lesser number, put -1.
Help his friend to find the two numbers.
-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, an integers $N$. 
- Next line contains $N$ integers separated by a space. 
- Next line contains a number to be found, $M$. 
-----Output:-----
For each test case, output in a single line answer given the immediate smaller and greater number separated by a space.
-----Constraints-----
- $1 \leq T \leq 1000$
- $3 \leq N \leq 10^5$
- $1 \leq N_i \leq 10^9$
- $1 \leq M \leq 10^9$
-----Sample Input:-----
1
10
5 15 1 66 55 32 40 22 34 11
38
-----Sample Output:-----
35 41
-----Explaination:-----
Step 1: 15 5 66 1 32 55 22 40 11 34
Step 2: 15 7 66 2 34 56 23 41 13 35
Step 3: 35  13 41 23 56 34 2 66 7 15
35 is the number lesser than 38 and 41 is the number greater than 38 in the given set of numbers.
# cook your dish here
try:
    t=int(input())
    for _ in range(t):
        n=int(input())
        a=list(map(int,input().split()))
        x=int(input())
        b=list(map(lambda x: x+x%3,a))
        b.sort()
        c1=0
        for lar in b:
            if(lar>x): 
                large=lar
                c1=1
                break
        if(c1==0): large=-1
        b.sort(reverse=True)
        c2=0
        for sma in b:
            if(sma<x): 
                small=sma
                c2=1
                break
        if(c2==0): small=-1
        print(small,large)
        
except:
    pass
# cook your dish here
try:
    t=int(input())
    for _ in range(t):
        n=int(input())
        a=list(map(int,input().split()))
        x=int(input())
        b=list(map(lambda x: x+x%3,a))
        b.sort()
        c1=0
        for lar in b:
            if(lar>x): 
                large=lar
                c1=1
                break
        if(c1==0): large=-1
        b.sort(reverse=True)
        c2=0
        for sma in b:
            if(sma<x): 
                small=sma
                c2=1
                break
        if(c2==0): small=-1
        print(small,large)
        
except:
    pass