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.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "'''\r\n\r\n\r\n1\r\n10\r\n5 15 1 66 55 32 40 22 34 11\r\n38\r\n\r\nStep 1: 15 5 66 1 32 55 22 40 11 34\r\n\r\nStep 2: 15 7 66 2 34 56 23 41 13 35\r\n\r\nStep 3: 35 13 41 23 56 34 2 66 7 15\r\n\r\n35 is the number lesser than 38 and 41 is the number greater than 38 in the given set of numbers.\r\n\r\n'''\r\n\r\n\r\nn=int(input())\r\nfor i in range(0,n):\r\n    o=int(input())\r\n    p=input().rstrip().split(' ')\r\n    x=int(input())\r\n    for j in range(0,len(p)-1,2):\r\n        A=int(p[j])\r\n        B=int(p[j+1])\r\n        p[j]=B+(B%3);\r\n        p[j+1]=A+(A%3);\r\n    if len(p)%2==1:\r\n        p[len(p)-1]=int(p[len(p)-1])+(int(p[len(p)-1]))%3;\r\n    # print(p)\r\n    p.sort(key=int)\r\n    ans1=-1;\r\n    ans2=-1;\r\n    I=0;\r\n    J=len(p)-1;\r\n    while(I<=J):\r\n        m=(I+J)//2;\r\n        if int(p[m])>=x:\r\n            J=m-1;\r\n        else:\r\n            ans1=int(p[m]);\r\n            I=m+1;\r\n    I=0;\r\n    J=len(p)-1;\r\n    while(I<=J):\r\n        m=(I+J)//2;\r\n        if int(p[m])<=x:\r\n            I=m+1;\r\n        else:\r\n            ans2=int(p[m]);\r\n            J=m-1;    \r\n    print(ans1,ans2)"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13771