#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX / 2;
signed main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin>>n;
vector<int>arr(n);
for(int i=0;i<n;i++){
cin>>arr[i];
}
sort(arr.begin(),arr.end());
int fir=arr[0];
int las=arr[n-1];
int cnt1=0;
int cnt2=0;
for(int i=0;i<n;i++){
if(arr[i] == fir)cnt1++;
if(arr[i] == las)cnt2++;
}
if((cnt1 >= n/2) && (cnt2 >=n/2))cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZW5kbCAnXG4nCiNkZWZpbmUgaW50IGxvbmcgbG9uZwogCmNvbnN0IGludCBNT0QgPSAxZTkgKyA3Owpjb25zdCBpbnQgSU5GID0gTExPTkdfTUFYIC8gMjsKIApzaWduZWQgbWFpbigpIHsKICAgIGlvczo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsgCiAgICBjaW4udGllKE5VTEwpOwogCiAgICBpbnQgdDsKICAgIGNpbiA+PiB0OwogICAgd2hpbGUgKHQtLSkgewogICAgICAgIGludCBuOwogICAgICAgIGNpbj4+bjsKICAgICAgICB2ZWN0b3I8aW50PmFycihuKTsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICAJY2luPj5hcnJbaV07CiAgICAgICAgfQogICAgICAgIHNvcnQoYXJyLmJlZ2luKCksYXJyLmVuZCgpKTsKICAgICAgICBpbnQgZmlyPWFyclswXTsKICAgICAgICBpbnQgbGFzPWFycltuLTFdOwogICAgICAgIGludCBjbnQxPTA7CiAgICAgICAgaW50IGNudDI9MDsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICAJaWYoYXJyW2ldID09IGZpciljbnQxKys7CiAgICAgICAgCWlmKGFycltpXSA9PSBsYXMpY250MisrOwogICAgICAgIH0KICAgICAgICBpZigoY250MSA+PSBuLzIpICYmIChjbnQyID49bi8yKSljb3V0PDwiWUVTIjw8ZW5kbDsKICAgICAgICBlbHNlIGNvdXQ8PCJOTyI8PGVuZGw7CiAgICB9CiAgICAKfQ==