#include <bits/stdc++.h>
using namespace std;
bool ans[11];
int main()
{
int t;
cin >> t;
for(int i=1; i<=t; i++)
{
ans[i] = true;
int n;
cin >> n;
int a[100001] = {};
for(int j=1; j<=n ;j++)
{
cin >> a[j];
}
sort(a,a+n);
for(int j=1; j<=n ;j++)
{
if(a[n] % a[j] != 0)
{
ans[i] = false;
break;
}
}
}
for(int i=1; i<=t; i++)
{
if(ans[i])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}