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 = '# cook your dish here\ntry:\n    t=int(input())\n    for _ in range(t):\n        n=int(input())\n        a=list(map(int,input().split()))\n        x=int(input())\n        b=list(map(lambda x: x+x%3,a))\n        b.sort()\n        c1=0\n        for lar in b:\n            if(lar>x): \n                large=lar\n                c1=1\n                break\n        if(c1==0): large=-1\n        b.sort(reverse=True)\n        c2=0\n        for sma in b:\n            if(sma<x): \n                small=sma\n                c2=1\n                break\n        if(c2==0): small=-1\n        print(small,large)\n        \nexcept:\n    pass'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13253