文件目录

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[100005] = {};
        for (int i = 1; i <= n; i++)
            scanf("%d", a + i);
        sort(a + 1, a + 1 + n);
        bool f = true;
        for (int i = n; i >= 1; i--)
        {
            if (a[n] % a[i])
            {
                f = false;
                break;
            }
        }
        if (f)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}