#include using namespace std; using ll = long long; using P = pair; #define rep(i, a, b) for(ll i = a; i < b; ++i) #define rrep(i, a, b) for(ll i = a; i >= b; --i) constexpr ll inf = 4e18; struct SetupIO { SetupIO() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(30); } } setup_io; int main(void) { int T; cin >> T; while(T--) { ll n; cin >> n; vector a(n); rep(i, 0, n) { cin >> a[i]; } rep(i, 0, n) { rep(j, i + 1, n) { ll g = gcd(a[i], a[j]); a[i] /= g; a[j] /= g; } } bool flag = true; rep(i, 0, n) { ll r = sqrtl(a[i]); if(r * r != a[i]) flag = false; } if(flag) { cout << "Yes" << '\n'; } else { cout << "No" << '\n'; } } }