//https://codeforces.com/problemset/problem/1203/B
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"sort"
)

func main() {
	var output bytes.Buffer
	in := bufio.NewReader(os.Stdin)
	q := 0
	n := 0
	completeSideArray := make([]int, 400)
	fmt.Fscan(in, &q)

	for ; q > 0; q-- {
		fmt.Fscan(in, &n)
		sideArray := completeSideArray[0 : 4*n]
		for i := 0; i < 4*n; i++ {
			fmt.Fscan(in, &sideArray[i])
		}

		sort.Ints(sideArray)
		i := 0
		j := 4*n - 1

		st := "YES"
		area := sideArray[0] * sideArray[j]
		for i < j {
			if sideArray[i] != sideArray[i+1] || sideArray[j-1] != sideArray[j] || sideArray[i]*sideArray[j] != area {
				st = "NO"
				break
			}
			i += 2
			j -= 2
		}
		output.WriteString(st + "\n")
	}
	fmt.Println(output.String())
}

package main
import "fmt"
import "bufio"
import "os"

var input *bufio.Reader
var dat [][]int

func resolve(x int) []int{
	var cnt []int
	for i:=2; i*i<=x; i++ {
		for ; x%i==0; x/=i {
			cnt = append(cnt, i)
		}
	}
	if x!=1 {
		cnt = append(cnt, x)
	}
	return cnt
}

func solve() {
	var n int
	fmt.Fscanf(input, "%d\n", &n)
	arr := make([]int, 4*n+1)
	cnt := make([]int, 10001)
	left := make([]int, 10001)
	for i:=1; i<=4*n; i++ {
		fmt.Fscanf(input, "%d", &arr[i])
		left[arr[i]]++
		for _, j := range dat[arr[i]] {
			cnt[j]++
		}
	}
	fmt.Fscanf(input, "\n");
	prod := 1
	for i:=1; i<=10000; i++ {
		if cnt[i]%(2*n)!=0 || left[i]%2!=0 {
			fmt.Println("NO")
			return
		}
		cnt[i]/=(2*n)
		left[i]*=2
		for j:=1; j<=cnt[i]; j++ {
			prod*=i
		}
	}
	for i:=1; i<=4*n; i++ {
		if left[arr[i]]==0 {
			fmt.Println("NO")
			return
		}
		left[arr[i]]--
		if prod%arr[i]==0 && left[prod/arr[i]]>=1 {
			left[prod/arr[i]]--
		} else {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

func init() {
	input = bufio.NewReader(os.Stdin)
	dat = make([][]int, 10001)
	for i:=1; i<=10000; i++ {
		dat[i] = resolve(i)
	}
}

func main(){
	var T int
	fmt.Fscanf(input, "%d\n", &T)
	for t:=1; t<=T; t++ {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {

	var (
		q int
		n int
	)
	input := bufio.NewReader(os.Stdin)

	//input, err := os.Open("input.txt")

	// if err != nil {
	// 	panic(err)
	// }
	reader := bufio.NewReader(input)
	fmt.Fscanf(reader, "%d\n", &q)

	for i := 0; i < q; i++ {
		fmt.Fscanf(reader, "%d\n", &n)

		iter := 4 * n
		nums := make([]int, 4*n)
		for i := 0; i < iter; i++ {
			fmt.Fscanf(reader, "%d", &nums[i])
		}
		fmt.Fscanf(reader, "\n")
		sort.Ints(nums)

		area := nums[0] * nums[iter-1]
		ok := true
		for i := 0; i < n; i++ {
			l := 2 * i
			r := 4*n - 2*i - 1
			if nums[l] == nums[l+1] && nums[r] == nums[r-1] && nums[l]*nums[r] == area {
				continue
			} else {
				ok = false
				break
			}
		}
		if ok {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"sort"
	"strconv"
)

/* solution */

func solve() {

	t := readInt()
	for i := 0; i < t; i++ {
		solveOne()
	}

}

func solveOne() {
	n := readInt()
	a := make([]int, 4*n)
	for i := 0; i < 4*n; i++ {
		a[i] = readInt()
	}
	sort.Ints(a)
	square := -1
	ok := true
	for i := 0; ok && i < n; i++ {
		ok = ok && a[2*i] == a[2*i+1] && a[4*n-2*i-1] == a[4*n-2*i-2]
		if ok && square == -1 {
			square = a[2*i] * a[4*n-2*i-1]
		}
		ok = ok && square == a[2*i]*a[4*n-2*i-1]
	}
	if ok {
		print("YES")
	} else {
		print("NO")
	}
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main
import "fmt"
import "bufio"
import "os"

func resolve(x int) []int{
	var cnt []int
	for i:=2; i*i<=x; i++ {
		for ; x%i==0; x/=i {
			cnt = append(cnt, i)
		}
	}
	if x!=1 {
		cnt = append(cnt, x)
	}
	return cnt
}

func main(){

	input := bufio.NewReader(os.Stdin)

	dat := make([][]int, 10001)
	for i:=1; i<=10000; i++ {
		dat[i] = resolve(i)
	}

	var T int
	fmt.Fscanf(input, "%d\n", &T)
	for t:=1; t<=T; t++ {
		var n int
		fmt.Fscanf(input, "%d\n", &n)
		arr := make([]int, 4*n+1)
		cnt := make([]int, 10001)
		left := make([]int, 10001)
		for i:=1; i<=4*n; i++ {
			fmt.Fscanf(input, "%d", &arr[i])
			left[arr[i]]++
			for _, j := range dat[arr[i]] {
				cnt[j]++
			}
		}
		fmt.Fscanf(input, "\n");
		ans := true
		for i:=1; i<=10000; i++ {
			if left[i]%2!=0 {
				fmt.Println("NO")
				ans = false
				break
			}
			left[i]*=2
		}
		if !ans {
			continue
		}
		prod := 1
		for i:=1; i<=10000; i++ {
			if cnt[i]%(2*n)!=0 {
				fmt.Println("NO")
				ans = false
				break
			}
			cnt[i]/=(2*n)
			for j:=1; j<=cnt[i]; j++ {
				prod*=i
			}
		}
		if !ans {
			continue
		}
		for i:=1; i<=4*n; i++ {
			if left[arr[i]]==0 {
				fmt.Println("NO")
				ans = false
				break
			}
			left[arr[i]]--
			if prod%arr[i]==0 && left[prod/arr[i]]>=1 {
				left[prod/arr[i]]--
			} else {
				fmt.Println("NO")
				ans = false
			}
		}
		if !ans {
			continue
		}
		fmt.Println("YES")
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	var n, q, cnt, x, area int

	scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Fscanln(scr, &q)

	for i := 0; i < q; i++ {
		fmt.Fscanln(scr, &n)
		cnt = 0
		m := make(map[int]int)

		for i := 0; i < 4*n; i++ {
			fmt.Fscanf(scr, "%d", &x)
			m[x]++
		}
		fmt.Fscanln(scr, &x)

		a := make([]int, 0)
		for x, y := range m {

			for i := 0; i < y/2; i++ {
				a = append(a, x)
			}
			if y%2 != 0 {
				cnt = 7
				break
			}
		}

		sort.Ints(a)

		if n > 1 && cnt != 7 {
			area = a[0] * a[len(a)-1]
			for i := 0; i < len(a)/2; i++ {
				if area != a[i]*a[len(a)-i-1] {
					cnt = 7
					break
				}
			}
		}

		if cnt == 7 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	input := bufio.NewReader(os.Stdin)

	var (
		total int
		n     int
	)

	_, _ = fmt.Fscan(input, &total)

	for t := 0; t < total; t += 1 {
		_, _ = fmt.Fscan(input, &n)

		stick := make([]int, n*4)
		count := make(map[int]int)
		for i := 0; i < n*4; i += 1 {
			_, _ = fmt.Fscan(input, &stick[i])
			count[stick[i]] += 1
		}

		isFound := true
		hasErr := false
		newSide := make([]int, 0)
		for k, v := range count {
			if v%2 != 0 {
				hasErr = true
				break
			}
			c := v / 2
			for i := 0; i < c; i++ {
				newSide = append(newSide, k)
			}
		}

		if hasErr {
			fmt.Println("NO")
			continue
		}

		sort.Ints(newSide)
		sum := newSide[0] * newSide[len(newSide)-1]
		for i, j := 0, len(newSide)-1; i < j; i, j = i+1, j-1 {
			if sum != newSide[i]*newSide[j] {
				isFound = false
				break
			}
		}

		if isFound {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscanf(input, "%d\n", &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var n int
		_, err := fmt.Fscanf(input, "%d\n", &n)
		if err != nil {
		}
		n *= 4
		var a = make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Fscanf(input, "%d", &a[i])
			if err != nil {
			}
		}
		_, err = fmt.Fscanf(input, "\n")
		if err != nil {
		}
		sort.Sort(sort.IntSlice(a))
		var h1 int
		var h2 int
		var w1 int
		var w2 int
		var area int
		area = a[0] * a[n - 1]
		var result bool
		result = true
		for i := 0; i < n / 2 + 1; i += 2 {
			//fmt.Printf("%d %d %d %d\n", i, i + 1, n - i - 1, n - i - 2)
			h1 = a[i]
			h2 = a[i + 1]
			w1 = a[n - i - 1]
			w2 = a[n - i - 2]
			if h1 == h2 && w1 == w2 && h1 * w1 == area {
				continue
			} else {
				result = false
				break
			}
		}
		if result {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	input := bufio.NewReader(os.Stdin)

	var Q int
	fmt.Fscanf(input, "%d\n", &Q)
	for q := 0; q < Q; q++ {
		var N int
		fmt.Fscanf(input, "%d\n", &N)
		P := make([]int, 4*N)
		for n := 0; n < 4*N; n++ {
			fmt.Fscanf(input, "%d", &P[n])
		}
		fmt.Fscanf(input, "\n")

		Ls := make(map[int]int)
		for n := 0; n < len(P); n++ {
			Ls[P[n]]++
		}
		ans := "YES"
		for _, count := range Ls {
			if count%2 != 0 {
				ans = "NO"
			}
		}
		if ans == "YES" {
			sort.Ints(P)
			l := 0
			r := len(P) - 1
			area := P[l] * P[r]
			l += 2
			r -= 2
			for l < r {
				if P[l]*P[r] != area {
					ans = "NO"
					break
				}
				l += 2
				r -= 2
			}
		}
		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"sort"
	"os"
	"bufio"
)

func main() {
	input := bufio.NewReader(os.Stdin)

	q, n := 0, 0
	fmt.Fscanf(input, "%d\n", &q)

	for ;q > 0; q-- {
		fmt.Fscanf(input, "%d\n", &n)
		l := n * 4
		a := make([]int, l)
		for j := 0; j < l; j++ {
			fmt.Fscanf(input, "%d", &a[j])
		}
		fmt.Fscanf(input, "\n")
		sort.Ints(a)
		area := a[0] * a[l - 1]
		ok := true
		for i := 0; i < l/2 + 1; i+=2 {
			ha := a[i]
			hb := a[i + 1]
			wa := a[l - i - 1]
			wb := a[l - i - 2]
			if ha == hb && wa == wb && ha * wa == area {
				continue
			}
			ok = false
			break
		}
		if ok {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscan(input, &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var x int
		_, err := fmt.Fscan(input, &x)
		if err != nil {
		}

		var a = make([]int, 4*x)
		var l = make([]int, 0)
		var lMap = make(map[int]int)

		for i := 0; i < 4*x; i++ {
			_, err := fmt.Fscan(input, &a[i])
			if err != nil {
			}
			_, ok := lMap[a[i]]
			if ok {
				lMap[a[i]] ++
			} else {
				lMap[a[i]] = 1
			}
		}

		var result = true
		for k, v := range lMap {
			if v%2 != 0 {
				result = false
				break
			}
			for i := 0; i < v/2; i++ {
				l = append(l, k)
			}
		}

		if result == false {
			fmt.Println("NO")
			continue
		}
		sort.Ints(l)
		r := l[0] * l[2*x-1]
		for i := 1; i < x; i++ {
			if l[i]*l[2*x-i-1] != r {
				result = false
				break
			}
		}

		if result == false {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}

}

package main
import "fmt"
import "bufio"
import "os"

var dat [][]int

func resolve(x int) []int{
	var cnt []int
	for i:=2; i*i<=x; i++ {
		for ; x%i==0; x/=i {
			cnt = append(cnt, i)
		}
	}
	if x!=1 {
		cnt = append(cnt, x)
	}
	return cnt
}

func main(){

	input := bufio.NewReader(os.Stdin)

	dat = make([][]int, 10001)
	for i:=1; i<=10000; i++ {
		dat[i] = resolve(i)
	}

	var T int
	fmt.Fscanf(input, "%d\n", &T)
	for t:=1; t<=T; t++ {
	var n int
	fmt.Fscanf(input, "%d\n", &n)
	arr := make([]int, 4*n+1)
	cnt := make([]int, 10001)
	left := make([]int, 10001)
	for i:=1; i<=4*n; i++ {
		fmt.Fscanf(input, "%d", &arr[i])
		left[arr[i]]++
		for _, j := range dat[arr[i]] {
			cnt[j]++
		}
	}
	fmt.Fscanf(input, "\n");
	ans := true
	for i:=1; i<=10000; i++ {
		if left[i]%2!=0 {
			fmt.Println("NO")
			ans = false
			break
		}
		left[i]*=2
	}
	if !ans {
		continue
	}
	prod := 1
	for i:=1; i<=10000; i++ {
		if cnt[i]%(2*n)!=0 {
			fmt.Println("NO")
			ans = false
			break
		}
		cnt[i]/=(2*n)
		for j:=1; j<=cnt[i]; j++ {
			prod*=i
		}
	}
	if !ans {
		continue
	}
	for i:=1; i<=4*n; i++ {
		if left[arr[i]]==0 {
			fmt.Println("NO")
			ans = false
			break
		}
		left[arr[i]]--
		if prod%arr[i]==0 && left[prod/arr[i]]>=1 {
			left[prod/arr[i]]--
		} else {
			fmt.Println("NO")
			ans = false
		}
	}
	if !ans {
		continue
	}
	fmt.Println("YES")
	}

}

//https://codeforces.com/problemset/problem/1203/B
package main

import (
	"fmt"
	"sort"
)

func main() {
	q := 0
	n := 0
	fmt.Scanf("%d", &q)

	for ; q > 0; q-- {
		fmt.Scanf("%d", &n)
		sideArray := make([]int, 4*n)
		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &sideArray[i])
		}

		sort.Ints(sideArray)
		i := 0
		j := 4*n - 1

		mp := make(map[int]bool)
		st := "YES"
		for i < j {
			if sideArray[i] != sideArray[i+1] || sideArray[j-1] != sideArray[j] {
				st = "NO"
				break
			}
			area := sideArray[i] * sideArray[j]
			mp[area] = true
			i += 2
			j -= 2
		}
		if len(mp) != 1 {
			st = "NO"
		}
		fmt.Println(st)
	}
}

//https://codeforces.com/problemset/problem/1203/B
package main

import (
	"fmt"
	"sort"
)

func main() {
	q := 0
	n := 0
	fmt.Scanf("%d", &q)

	for ; q > 0; q-- {
		fmt.Scanf("%d", &n)
		sideArray := make([]int, 4*n)
		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &sideArray[i])
		}
		sort.Ints(sideArray)
		i := 0
		j := 4*n - 1

		mp := make(map[int]bool)
		st := "YES"
		for i < j {
			if sideArray[i] != sideArray[i+1] || sideArray[j-1] != sideArray[j] {
				st = "NO"
				break
			}
			area := sideArray[i] * sideArray[j]
			mp[area] = true
			i += 2
			j -= 2
		}
		if len(mp) > 1 {
			st = "NO"
		}
		fmt.Println(st)
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, q, cnt, x, sum, area int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&q)

	for i := 0; i < q; i++ {
		fmt.Scanln(&n)
		cnt = 0

		m := make(map[int]int)

		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &x)
			m[x]++
		}
		fmt.Scanln(&x)

		a := make([]int, 0)
		for x, y := range m {

			for i := 0; i < y/2; i++ {
				a = append(a, x)
			}
			if y%2 != 0 {
				cnt = 7
				break
			}
			sum += y
		}

		if cnt != 7 && sum%4 != 0 {
			cnt = 7
		}

		sort.Ints(a)

		if n > 1 && cnt != 7 {
			area = a[0] * a[len(a)-1]
			for i := 0; i < len(a)/2; i++ {
				if area != a[i]*a[len(a)-i-1] {
					cnt = 7
					break
				}
			}
		}

		if cnt == 7 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, q, cnt, x, sum, area int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&q)

	for i := 0; i < q; i++ {
		fmt.Scanln(&n)
		cnt = 0

		m := make(map[int]int)

		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &x)
			m[x]++
		}
		fmt.Scanln(&x)

		a := make([]int, 0)
		for x, y := range m {

			for i := 0; i < y/2; i++ {
				a = append(a, x)
			}
			if y%2 != 0 {
				cnt = 7
				break
			}
			sum += y
		}

		if cnt != 7 && sum%4 != 0 {
			cnt = 7
		}

		if cnt != 7 {
			area = a[0] * a[len(a)-1]
			for i := 0; i < len(a)/2; i++ {
				if area != a[i]*a[len(a)-i-1] {
					cnt = 7
					break
				}
			}
		}

		if cnt == 7 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, q, cnt, x, sum, area int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&q)

	for i := 0; i < q; i++ {
		fmt.Scanln(&n)
		cnt = 0

		m := make(map[int]int)

		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &x)
			m[x]++
		}
		fmt.Scanln(&x)

		a := make([]int, 0)
		for x, y := range m {

			for i := 0; i < y/2; i++ {
				a = append(a, x)
			}
			if y%2 != 0 {
				cnt = 7
				break
			}
			sum += y
		}

		if cnt != 7 && sum%4 != 0 {
			cnt = 7
		}

		if n > 1 && cnt != 7 {
			area = a[0] * a[len(a)-1]
			for i := 0; i < len(a)/2; i++ {
				if area != a[i]*a[len(a)-i-1] {
					cnt = 7
					break
				}
			}
		}

		if cnt == 7 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, q, cnt, x, sum int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&q)

	for i := 0; i < q; i++ {
		fmt.Scanln(&n)
		cnt = 0

		m := make(map[int]int)

		for i := 0; i < 4*n; i++ {
			fmt.Scanf("%d", &x)
			m[x]++
		}
		fmt.Scanln(&x)

		a := make([]int, 0)
		for x, y := range m {

			for i := 0; i < y/2; i++ {
				a = append(a, x)
			}
			if y%2 != 0 {
				cnt = 7
				break
			}
			sum += y
		}

		if cnt != 7 && sum%4 != 0 {
			cnt = 7
		}

		if cnt != 7 {
			area := a[0] * a[len(a)-1]
			for i := 0; i < len(a); i++ {
				if area != a[i]*a[len(a)-i-1] {
					cnt = 7
					break
				}
			}
		}

		if cnt == 7 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	input := bufio.NewReader(os.Stdin)

	var (
		total int
		n     int
	)

	_, _ = fmt.Fscan(input, &total)

	for t := 0; t < total; t += 1 {
		_, _ = fmt.Fscan(input, &n)

		stick := make([]int, n*4)
		count := make(map[int]int)
		for i := 0; i < n*4; i += 1 {
			_, _ = fmt.Fscan(input, &stick[i])
			count[stick[i]] += 1
		}

		if n == 1 {
			fmt.Println("YES")
			continue
		}

		isFound := true
		hasErr := false
		newSide := make([]int, 0)
		for k, v := range count {
			if v%2 != 0 {
				hasErr = true
				break
			}
			c := v / 2
			for i := 0; i < c; i++ {
				newSide = append(newSide, k)
			}
		}

		if hasErr {
			fmt.Println("NO")
			continue
		}

		sort.Ints(newSide)
		sum := newSide[0] * newSide[len(newSide)-1]
		for i, j := 0, len(newSide)-1; i < j; i, j = i+1, j-1 {
			if sum != newSide[i]*newSide[j] {
				isFound = false
				break
			}
		}

		if isFound {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"fmt"
	"os"
)

func settest() (*os.File, *os.File) {
	f, err := os.Open("a.dat")
	if err != nil {
		panic(err)
	}

	oldStdin := os.Stdin
	os.Stdin = f

	return f, oldStdin
}

func main() {
	/*f, oldStdin := settest()
	defer f.Close()
	defer func() { os.Stdin = oldStdin }()*/

	q, n := 0, 0
	fmt.Scan(&q)

	for ;q > 0; q-- {
		fmt.Scan(&n)
		m := map[int]int{}
		for j := 0; j < n * 4; j++ {
			var a int
			fmt.Scan(&a)
			m[a]++
		}
		m2 := map[int]int{}
		for k, v := range m {
			t := v/2
			if t > 0 {
				m2[k] = t
			}
		}
		p := []int{}
		for k, v := range m2 {
			for i := 0; i < v; i++ {
				p = append(p, k)
			}
		}
		//fmt.Println(n)
		//fmt.Println(p)
		l := len(p)
		t := [][]int{}
		for i := 0; i < l; i++ {
			a := []int{}
			for j := 0; j < l; j++ {
				if j != i {
					a = append(a, p[i] * p[j])
				} else {
					a = append(a, 0)
				}
			}
			t = append(t, a)
		}
		//fmt.Println(t)
		m3 := map[int]int{}
		for i := 0; i < l; i++ {
			m4 := map[int]bool{}
			for j := 0; j < l; j++ {
				if i != j {
					if _, ok := m4[t[i][j]]; !ok {
						m3[t[i][j]]++
						m4[t[i][j]] = true
					}
				}
			}
		}
		//fmt.Println(m3)
		ok := false
		for _, v := range m3 {
			if v >= n * 2 {
				ok = true
				fmt.Println("YES")
				break
			}
		}
		if !ok {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	q, n := 0, 0
	fmt.Scan(&q)

	for ;q > 0; q-- {
		fmt.Scan(&n)
		m := map[int]int{}
		for j := 0; j < n * 4; j++ {
			var a int
			fmt.Scan(&a)
			m[a]++
		}
		m2 := map[int]int{}
		for k, v := range m {
			t := v/2
			if t > 0 {
				m2[k] = t
			}
		}
		p := []int{}
		for k, v := range m2 {
			for i := 0; i < v; i++ {
				p = append(p, k)
			}
		}
		l := len(p)
		rows := make([]map[int]bool, l)
		cols := make([]map[int]bool, l)
		m3 := map[int]int{}
		for i := 0; i < l; i++ {
			for j := i + 1; j < l; j++ {
				if i != j {
					_, oki := rows[i][p[i] * p[j]]
					_, okj := cols[j][p[i] * p[j]]
					if !oki && !okj {
						if rows[i] == nil {
							rows[i] = map[int]bool{}
						}
						rows[i][p[i] * p[j]] = true
						if cols[j] == nil {
							cols[j] = map[int]bool{}
						}
						cols[j][p[i] * p[j]] = true
						m3[p[i] * p[j]]++
						if m3[p[i] * p[j]] >= n {
							fmt.Println("YES")
							goto done
						}
					}
				}
			}
		}
		fmt.Println("NO")
done:
	}
}

package main

import (
	"fmt"
)

func main() {
	/*f, oldStdin := settest()
	defer f.Close()
	defer func() { os.Stdin = oldStdin }()*/

	q, n := 0, 0
	fmt.Scan(&q)

	for ;q > 0; q-- {
		fmt.Scan(&n)
		m := map[int]int{}
		for j := 0; j < n * 4; j++ {
			var a int
			fmt.Scan(&a)
			m[a]++
		}
		m2 := map[int]int{}
		for k, v := range m {
			t := v/2
			if t > 0 {
				m2[k] = t
			}
		}
		p := []int{}
		for k, v := range m2 {
			for i := 0; i < v; i++ {
				p = append(p, k)
			}
		}
		//fmt.Println(n)
		//fmt.Println(p)
		l := len(p)
		t := [][]int{}
		for i := 0; i < l; i++ {
			a := []int{}
			for j := 0; j < l; j++ {
				if j != i {
					a = append(a, p[i] * p[j])
				} else {
					a = append(a, 0)
				}
			}
			t = append(t, a)
		}
		//fmt.Println(t)
		m3 := map[int]struct{i, j, v int}{}
		for i := 0; i < l; i++ {
			for j := 0; j < l; j++ {
				if i != j {
					tmp := m3[t[i][j]]
					if tmp.i != i + 1 && tmp.j != j + 1 {
						tmp.i = i + 1
						tmp.j = j + 1
						tmp.v++
						m3[t[i][j]] = tmp
					}
				}
			}
		}
		//fmt.Println(m3)
		ok := false
		for _, v := range m3 {
			if v.v >= n * 2 {
				ok = true
				fmt.Println("YES")
				break
			}
		}
		if !ok {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	q, n := 0, 0
	fmt.Scan(&q)

	for ;q > 0; q-- {
		fmt.Scan(&n)
		m := map[int]int{}
		for j := 0; j < n * 4; j++ {
			var a int
			fmt.Scan(&a)
			m[a]++
		}
		m2 := map[int]int{}
		for k, v := range m {
			t := v/2
			if t > 0 {
				m2[k] = t
			}
		}
		p := []int{}
		for k, v := range m2 {
			for i := 0; i < v; i++ {
				p = append(p, k)
			}
		}
		//fmt.Println(n)
		//fmt.Println(p)
		l := len(p)
		t := [][]int{}
		for i := 0; i < l; i++ {
			a := []int{}
			for j := 0; j < l; j++ {
				if j != i {
					a = append(a, p[i] * p[j])
				} else {
					a = append(a, 0)
				}
			}
			t = append(t, a)
		}
		fmt.Println()
		rows := make([]map[int]bool, l)
		cols := make([]map[int]bool, l)
		m3 := map[int]int{}
		for i := 0; i < l/2; i++ {
			for j := l/2; j < l; j++ {
				if i != j {
					_, oki := rows[i][t[i][j]]
					_, okj := cols[j][t[i][j]]
					if !oki && !okj {
						if rows[i] == nil {
							rows[i] = map[int]bool{}
						}
						rows[i][t[i][j]] = true
						if cols[j] == nil {
							cols[j] = map[int]bool{}
						}
						cols[j][t[i][j]] = true
						m3[t[i][j]]++
						if m3[t[i][j]] >= n {
							fmt.Println("YES")
							goto done
						}
					}
				}
			}
		}
		fmt.Println("NO")
done:
	}
}

package main

import (
	"fmt"
)

func main() {
	q, n := 0, 0
	fmt.Scan(&q)

	for ;q > 0; q-- {
		fmt.Scan(&n)
		m := map[int]int{}
		for j := 0; j < n * 4; j++ {
			var a int
			fmt.Scan(&a)
			m[a]++
		}
		m2 := map[int]int{}
		for k, v := range m {
			t := v/2
			if t > 0 {
				m2[k] = t
			}
		}
		p := []int{}
		for k, v := range m2 {
			for i := 0; i < v; i++ {
				p = append(p, k)
			}
		}
		//fmt.Println(n)
		//fmt.Println(p)
		l := len(p)
		t := [][]int{}
		for i := 0; i < l; i++ {
			a := []int{}
			for j := 0; j < l; j++ {
				if j != i {
					a = append(a, p[i] * p[j])
				} else {
					a = append(a, 0)
				}
			}
			t = append(t, a)
		}
		//fmt.Println(t)
		m3 := map[int]int{}
		for i := 0; i < l; i++ {
			m4 := map[int]bool{}
			for j := 0; j < l; j++ {
				if i != j {
					if _, ok := m4[t[i][j]]; !ok {
						m3[t[i][j]]++
						m4[t[i][j]] = true
					}
				}
			}
		}
		//fmt.Println(m3)
		ok := false
		for _, v := range m3 {
			if (n%2 == 0 && v >= n * 2) || (n%2 != 0 && v >= n * 2 - 1) {
				ok = true
				fmt.Println("YES")
				break
			}
		}
		if !ok {
			fmt.Println("NO")
		}
	}
}