zushu=int(input())
while(zushu):
arrLen = int(input())
arr = input().split(" ")
dicts = {}
a = 1
for item in arr:
if item in dicts:
dicts[item]+=1
else:
dicts[item]=1
for key in dicts:
if dicts[key] > arrLen//2 :
a = 0
if a==1:
print("YES")
else:
print("NO")
zushu-=1