You are given $4n$ sticks, the length of the $i$-th stick is $a_i$.

You have to create $n$ rectangles, each rectangle will consist of exactly $4$ sticks from the given set. The rectangle consists of four sides, opposite sides should have equal length and all angles in it should be right. Note that each stick can be used in only one rectangle. Each stick should be used as a side, you cannot break the stick or use it not to the full length.

You want to all rectangles to have equal area. The area of the rectangle with sides $a$ and $b$ is $a \cdot b$.

Your task is to say if it is possible to create exactly $n$ rectangles of equal area or not.

You have to answer $q$ independent queries.


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 500$) — the number of queries. Then $q$ queries follow.

The first line of the query contains one integer $n$ ($1 \le n \le 100$) — the number of rectangles.

The second line of the query contains $4n$ integers $a_1, a_2, \dots, a_{4n}$ ($1 \le a_i \le 10^4$), where $a_i$ is the length of the $i$-th stick.


-----Output-----

For each query print the answer to it. If it is impossible to create exactly $n$ rectangles of equal area using given sticks, print "NO". Otherwise print "YES".


-----Example-----
Input
5
1
1 1 10 10
2
10 5 2 10 1 1 2 5
2
10 5 1 10 5 1 1 1
2
1 1 1 1 1 1 1 1
1
10000 10000 10000 10000

Output
YES
YES
NO
YES
YES
[{"code": "for _ in range(int(input())):\n    n = int(input())\n    A = list(map(int, input().split()))\n    B = {}\n    for i in A:\n        if i not in B:\n            B[i] = 0\n        B[i] += 1\n    ans = 'YES'\n    J = []\n    for i in B:\n        if B[i] % 2:\n            ans = 'NO'\n            break\n        else:\n            for _ in range(B[i] // 2):\n                J.append(i)\n    if ans == 'YES':\n        J.sort()\n        s = set()\n        for i in range(n):\n            s.add(J[i] * J[-i-1])\n        if len(s) != 1:\n            ans = 'NO'\n    print(ans)", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "from sys import stdin\nfrom collections import deque\nq=int(stdin.readline().strip())\nfor i in range(q):\n    n=int(stdin.readline().strip())\n    s=list(map(int,stdin.readline().strip().split()))\n    s.sort()\n    s=deque(s)\n    t=True\n    A=s[0]*s[-1]\n    while len(s)>0:\n        a1=s[0]*s[-1]\n        if a1!=A or s[0]!=s[1] or s[-1]!=s[-2]:\n            t=False\n            break\n        s.popleft()\n        s.popleft()\n        s.pop()\n        s.pop()\n    if t :\n        print(\"YES\")\n    else:\n        print(\"NO\")\n        \n", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "q = int(input())\nfor i in range(q):\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\ta.sort()\n\tfor i in range(0, 2 * n, 2):\n\t\tif a[i] != a[i + 1] or a[-i-1] != a[-i-2]:\n\t\t\tprint('NO')\n\t\t\tbreak\n\t\tif i == 0:\n\t\t\tarea = a[i] * a[-i-1]\n\t\telse:\n\t\t\tif area != a[i] * a[-i-1]:\n\t\t\t\tprint('NO')\n\t\t\t\tbreak\n\telse:\n\t\tprint('YES')\n\n", "passed": true, "time": 0.23, "memory": 14108.0, "status": "done"}, {"code": "T = int(input())\nfor t in range(T):\n    n = int(input())\n    A = [int(i) for i in input().split()]\n    A.sort()\n    ok = 1\n    areas = []\n    left = 0\n\n    right = 4*n - 1\n    for i in range(n):\n        l1 = left\n        l2 = left + 1\n\n        r1 = right\n        r2 = right - 1\n        \n        if not (A[l1] == A[l2] and A[r1] == A[r2]):\n            ok = 0    \n        areas.append(A[l1]*A[r1])\n\n        left += 2\n        right -= 2\n        \n    #print(areas, ok)\n    if len(set(areas)) == 1 and ok:\n        print('YES')\n    else:\n        print('NO')\n", "passed": true, "time": 0.25, "memory": 14112.0, "status": "done"}, {"code": "q = int(input())\nfor _ in range(q):\n    n = int(input())\n    a = list(map(int, input().split()))\n    a.sort()\n    pos = True\n    for i in range(0, 4 * n, 2):\n        if a[i] != a[i + 1]:\n            pos = False\n            break\n    area = a[0] * a[-1]\n    if pos:\n        for i in range(2, 2 * n, 2):\n            pos = pos and a[i] * a[-i - 1] == area\n    print('YES' if pos else 'NO')\n", "passed": true, "time": 0.15, "memory": 14156.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n = int(input())\n    a = [int(i) for i in input().split()]\n    a.sort()\n    i = 1\n    j = len(a)-2\n    ans = \"YES\"\n    area = a[0]*a[-1]\n    while i<j:\n        if a[i] == a[i-1] and a[j] == a[j+1] and a[i]*a[j]==area:\n            i+=2\n            j-=2\n        else:\n            ans = \"NO\"\n            break\n    print(ans)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n = int(input())\n    a = list(sorted(map(int, input().split())))\n    b = []\n    for i in range(0, len(a), 2):\n        if a[i + 1] != a[i]:\n            print(\"NO\")\n            break\n        b.append(a[i])\n    else:\n        s = b[0] * b[-1]\n        for j in range(1, len(a) // 2):\n            if b[j] * b[-j-1] != s:\n                print(\"NO\")\n                break\n        else:\n            print(\"YES\")", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "def main():\n  q = int(input())\n  for _ in range(q):\n    n = int(input())\n    slist = list(sorted(map(int, input().split())))\n    li, ri = 0, 4*n-1\n    ans = None\n    for j in range(n):\n      if slist[li] != slist[li+1] or slist[ri] != slist[ri-1]:\n        print('NO')\n        break\n      if ans is None:\n        ans = slist[li]*slist[ri]\n        li += 2\n        ri -= 2\n      else:\n        if ans != slist[li]*slist[ri]:\n          print('NO')\n          break\n        else:\n          li += 2\n          ri -= 2\n    else:\n      print('YES')\n\n\ndef __starting_point():\n  main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14248.0, "status": "done"}, {"code": "Q = int(input())\nfor q in range(Q):\n    N = int(input())\n    A = sorted([int(a) for a in input().split()])\n    S = A[0] * A[-1]\n    i, j = 0, 4*N-1\n    for _ in range(N):\n        if not(A[i] == A[i+1] and A[j] == A[j-1] and A[i] * A[j] == S):\n            print(\"NO\")\n            break\n        i += 2\n        j -= 2\n    else:\n        print(\"YES\")\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "q=int(input())\nfor i in range(q):\n    t=int(input())\n    arr=[int(x) for x in input().split()]\n    arr.sort()\n    pos=True\n    lengths=[]\n    for j in range(2*t):\n        if arr[2*j]!=arr[2*j+1]:\n            pos=False\n            break\n        lengths.append(arr[2*j])\n    if pos==True:\n        area=lengths[0]*lengths[2*t-1]\n        for j in range(t-1):\n            if lengths[1+j]*lengths[2*t-2-j]!=area:\n                pos=False\n                break\n    if pos==True:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n        \n", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "def gns():\n    return list(map(int,input().split()))\n\nt=int(input())\n\n\nfor i in range(t):\n    n=int(input())\n    ns=gns()\n    ns.sort()\n    a=ns[0]*ns[-1]\n    f=True\n    for i in range(4*n):\n        if i%2==1:\n            continue\n        if ns[i]!=ns[i+1]:\n            f=False\n            break\n    if not f:\n        print('NO')\n        continue\n    for i in range(4*n):\n        if ns[i]*ns[4*n-1-i]!=a:\n            f=False\n            break\n    if not f:\n        print('NO')\n        continue\n    print('YES')\n\n\n\n", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "#579_B\n\nimport sys\n\nq = int(input())\n\nfor i in range(0, q):\n    n = int(input())\n    ln = [int(j) for j in sys.stdin.readline().rstrip().split(\" \")]\n    ln = sorted(ln)\n    f = True\n    for j in range(1, len(ln), 2):\n        if ln[j] != ln[j - 1]:\n            f = False\n\n    ind1 = 0\n    ind2 = len(ln) - 2\n    sm = ln[ind1] * ln[ind2]\n    while ind1 < ind2:\n        ind1 += 2\n        ind2 -= 2\n        if ln[ind1] * ln[ind2] != sm:\n            f = False\n            break\n    if f:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "q = int(input())\nfor _ in range(q):\n    n = int(input())\n    a = list(map(int, input().split()))\n\n    def solve(a):\n        from collections import Counter\n        c = Counter(a)\n        keys = sorted(c)\n        for key in keys:\n            if c[key] % 2 != 0:\n                return False\n        temp = [[k]*c[k] for k  in keys]\n        keys = []\n        for t in temp:\n            keys += t\n        area = keys[0] * keys[-1]\n        head = 0\n        tail = len(keys) - 1\n        if len(keys) % 2 != 0:\n            return False\n        while head < tail:\n            if keys[head] * keys[tail] != area:\n                return False\n            head += 1\n            tail -= 1\n        return True\n    print(\"YES\" if solve(a) else \"NO\")\n", "passed": true, "time": 0.25, "memory": 14176.0, "status": "done"}, {"code": "import sys\ninput=sys.stdin.readline\ndef query(n,A):\n    A.sort()\n    B=[]\n    for i in range(0,n*4,2):\n        if A[i]!=A[i+1]:\n            return 'NO'\n        B.append(A[i])\n    s=B[0]*B[-1]\n    for i in range(n*2):\n        if B[i]*B[-i-1]!=s:\n            return 'NO'\n    return 'YES'\n\nq=int(input())\nfor _ in range(q):\n    n=int(input())\n    A=list(map(int,input().split()))\n    print(query(n,A))", "passed": true, "time": 0.15, "memory": 14300.0, "status": "done"}, {"code": "for _ in range(int(input())):\n\tn=int(input())\n\tl=list(map(int,input().split()))\n\td1={}\n\tfor i in l:\n\t\tif i in d1:\n\t\t\td1[i]+=1\n\n\t\telse:\n\t\t\td1[i]=1\n\n\tf=True\n\tli=[]\n\tfor i in d1:\n\t\tif d1[i]%2!=0:\n\t\t\tf=False\n\t\t\tbreak\n\t\telse:\n\t\t\tli.extend([i]*(d1[i]//2))\n\n\tif f:\n\t\tli.sort()\n\t\tc=li[0]*li[-1]\n\t\ti=1\n\t\tj=len(li)-2\n\t\twhile i<j:\n\t\t\tif c!=li[i]*li[j]:\n\t\t\t\tf=False\n\t\t\t\tbreak\n\n\t\t\telse:\n\t\t\t\ti+=1\n\t\t\t\tj-=1\n\t\tif f:\n\t\t\tprint(\"YES\")\n\n\t\telse:\n\t\t\tprint(\"NO\")\n\n\telse:\n\t\tprint(\"NO\")\n\n", "passed": true, "time": 0.15, "memory": 14344.0, "status": "done"}, {"code": "t = int(input())\nfor u in range(t):\n\tn = int(input())\n\tn = n*4\n\tx = list(map(int, input().split()))\n\tx.sort()\n\ti = 0\n\tf = []\n\twhile(i < n):\n\t\tif(x[i]==x[i+1]):\n\t\t\tf += [x[i]]\n\t\t\ti += 2\n\t\telse:\n\t\t\tbreak\n\tans = \"YES\"\n\tif(len(f)==n//2):\n\t\tar = f[0]*f[-1]\n\t\ti = 0\n\t\tj = len(f)-1\n\t\tfor k in range(n//4):\n\t\t\tif(f[i]*f[j] != ar):\n\t\t\t\tans = \"NO\"\n\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\ti += 1\n\t\t\t\tj -= 1\n\telse:\n\t\tans = \"NO\"\n\tprint(ans)\n", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "q = int(input())\nfor qq in range(q):\n    n = int(input())\n    *a, = list(map(int, input().split()))\n    a = list(sorted(a))\n    br = False\n    for i in range(2*n):\n        if a[2*i] != a[2*i+1]:\n            print(\"NO\")\n            br = True\n            break\n    if br:\n        continue\n    a = a[::2]\n    ar = a[0]*a[-1]\n    for i in range(n):\n        if a[i]*a[-i-1] != ar:\n            print(\"NO\")\n            break\n    else:\n        print(\"YES\")\n", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "import io, os\n#input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline\n\nq = int(input())\n\nfor i in range(q):\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\td = {}\n\tmn, mx = 10 ** 18, 0\n\tfor c in a:\n\t\tif c < mn:\n\t\t\tmn = c\n\t\tif c > mx:\n\t\t\tmx = c\n\t\td[c] = d.get(c, 0) + 1\n\t\n\ts = mn * mx\n\tf = True\n\tfor c in d:\n\t\tif not(d[c] % 2 == 0 and s % c == 0 and d.get(s // c, 0) == d[c]):\n\t\t\tf = False\n\t\t\tprint(\"NO\")\n\t\t\tbreak\n\tif f:\n\t\tprint(\"YES\")\n\t\n", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "q = int(input())\nfor Q in range(q):\n    n = int(input())\n    arr = list(map(int, input().split()))\n    arr2 = []\n    unused = set()\n    for i in arr:\n        if i not in unused:\n            unused.add(i)\n        else:\n            arr2.append(i)\n            unused.remove(i)\n\n    if len(unused) != 0:\n        print(\"NO\")\n    else:\n        flag = True\n        arr2.sort()\n        s = arr2[0] * arr2[-1]\n        arr2 = arr2[1:-1]\n        while len(arr2) != 0:\n            s2 = arr2[0] * arr2[-1]\n            if s2 != s:\n                print(\"NO\")\n                flag = False\n                break\n            else:\n                arr2 = arr2[1:-1]\n        if flag:\n            print(\"YES\")\n", "passed": true, "time": 0.22, "memory": 14260.0, "status": "done"}, {"code": "N = int(input())\nfor i in range(N):\n    A = int(input())\n    B = list(map(int,input().split()))\n    B.sort()\n    flag = True\n    for i in range(2*A):\n        if B[2*i] != B[2*i+1]:\n            flag = False\n            break\n    S = B[0]*B[-1]\n    for i in range(A):\n        if B[i*2] * B[-i*2-1] != S:\n            flag = False\n            break\n    print([\"NO\",\"YES\"][flag])\n", "passed": true, "time": 0.15, "memory": 14124.0, "status": "done"}, {"code": "q = int(input())\nfor j in range(q):\n    n = int(input())\n    a = list(map(int, input().split()))\n    a = sorted(a)\n    if n == 1:\n        if a[0] == a[1] and a[2] == a[3]:\n            print('YES')\n        else:\n            print('NO')\n    else:\n        b = []\n        for i in range(0, 4 * n - 1, 2):\n            if a[i] == a[i + 1]:\n                b.append(a[i])\n        #print(b)\n        if len(b) == 2 * n:\n            x = b[0] * b[2 * n - 1]\n            for i in range(1, n):\n                #print(x)\n                if b[i] * b[2 * n - i - 1]== x:\n                    x = b[i] * b[2 * n - i - 1]\n                else:\n                    x = 0\n                    break\n            if x != 0:\n                print('YES')\n            else:\n                print('NO')\n        else:\n            print('NO')\n            \n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n=int(input())\n    a=list(map(int,input().split()))\n    a.sort()\n    t=[]\n    k=0\n    for i in range(0,2*n,2):\n        if a[i]==a[i+1] and a[4*n-i-1]==a[4*n-i-2]:\n            s=a[i]*a[4*n-i-1]\n            t.append(s)\n            \n\n        else:\n            k+=1\n    if k>0:\n        print('NO')\n    else:\n        if len(list(set(t)))==1:\n            print('YES')\n        else:\n            print('NO')\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n=int(input())\n    a=list(map(int,input().split()))\n    hsh=[0]*max(a)\n    for i in a:\n        hsh[i-1]+=1\n    flag=0\n    for i in hsh:\n        flag+=i%2\n        if(flag):\n            break\n    if(flag):\n        print(\"NO\")\n    else:\n        a.sort()\n        s=a[0]*a[-1]\n        for i in range(2*n):\n            if(a[i]*a[4*n-1-i]!=s):\n                flag=1\n                break\n        if(flag):\n            print(\"NO\")\n        else:\n            print(\"YES\")\n\n", "passed": true, "time": 0.18, "memory": 14284.0, "status": "done"}, {"code": "q=int(input())\nwhile q:\n    n=int(input())\n    a=input().split()\n    for i in range(4*n):\n        a[i]=int(a[i])\n    a.sort()\n    count=0\n    value=a[0]*a[4*n-1]\n    j=0\n    while j<=2*n-2:\n        if(a[j]==a[j+1] and a[4*n-j-1]==a[4*n-j-2]):\n            if(a[j]*a[4*n-j-1]==value):\n                count+=1\n        j+=2      \n    if(count==n) : print(\"YES\")\n    else: print(\"NO\")\n    q-=1    ", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "q = int(input())\nfor i in range(q):\n    n = int(input())\n    a = list(map(int, input().split()))\n    a.sort()\n    ans = True\n    S = -1\n    i = 0\n    for j in range(n):\n        if a[i] == a[i + 1] and a[-(1 + i)] == a[-(2 + i)]:\n            if S == -1 or S == a[i] * a[-(1 + i)]:\n                S = a[i] * a[-(1 + i)]\n            else:\n                ans = False\n                break\n        else:\n            ans = False\n            break\n        i += 2\n    if ans:\n        print(\"YES\")\n    else:\n        print(\"NO\")", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}]