#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase ll t; cin>>t;while(t--){solve();}
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
// #define l s.size()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define re return
#define nl cout<<endl;
#define neg() cout<<-1<<endl;
#define c() cout<<c<<endl;
#define o(n) cout<<n;
#define i(n) ll n;cin>>n;
#define sa(a,n) sort(a,a+n)
#define ra(a,n) reverse(a,a+n)
#define s(x) sort(x.begin(),x.end())
#define rvec(v) reverse(v.begin(),v.end())
#define f(n) for(ll i=0;i<n;i++)
#define f1(n) for(ll i=1;i<n;i++)
#define f2(i,a,b) for(ll i=a;i<b;i++)
#define pa(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define pvec(v,n) for(ll i=0;i<n;i++){cout<<v[i]<<" ";}cout<<endl;
#define ppair(v,n) for(ll i=0;i<n;i++){cout<<v[i].ff<<" "<<v[i].ss<<" , ";}cout<<endl;
#define str(s) string s;cin>>s;
#define arr(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
#define vec(v,n) vector<ll> v;for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define vec1(v,b) vector<ll> v(b,0);for(ll i=1;i<=n;i++){ll x;cin>>x;v[i]=x;}
// mx=*max_element(a,a+n)
//index=upper_bound(a,a+n,x)-a;
// A=65 Z=90
// a=97 z=122
//--------------------------------------------------------------------------------------------------------------------*/
const ll N =2e5+5;
ll presum1[N];
ll presum2[N];
void solve(){
vector<pair<ll,ll>> vp;
vector<ll> b;
map<ll,ll> m;
ll c=0,sum=0;
ll maxi=INT_MAX;
ll ans=0;
/*------------------------------------------------------------------------*/
i(n);
arr(a,n);
sa(a,n);
if(a[0]!=a[1]){yes;re;}
f(n){
if(a[i]%a[0]){yes;re;}
}
no;re;
/*---------------------------------------------------------------------------------*/
}
int main(){
optimize;
testcase;
// solve();
}
866. Prime Palindrome | 1516A - Tit for Tat |
622. Design Circular Queue | 814. Binary Tree Pruning |
791. Custom Sort String | 787. Cheapest Flights Within K Stops |
779. K-th Symbol in Grammar | 701. Insert into a Binary Search Tree |
429. N-ary Tree Level Order Traversal | 739. Daily Temperatures |
647. Palindromic Substrings | 583. Delete Operation for Two Strings |
518. Coin Change 2 | 516. Longest Palindromic Subsequence |
468. Validate IP Address | 450. Delete Node in a BST |
445. Add Two Numbers II | 442. Find All Duplicates in an Array |
437. Path Sum III | 436. Find Right Interval |
435. Non-overlapping Intervals | 406. Queue Reconstruction by Height |
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |