// #define _GLIBCXX_DEBUG #include using namespace std; using uint = unsigned int; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define GETLINE( A ) string A; getline( cin , A ) #define GETLINE_SEPARATE( A , SEPARATOR ) string A; getline( cin , A , SEPARATOR ) #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( ll VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ ) #define REPEAT( HOW_MANY_TIMES ) FOR_LL( VARIABLE_FOR_REPEAT , 0 , HOW_MANY_TIMES ) #define RETURN( ANSWER ) cout << ( ANSWER ) << endl; return 0 #define DOUBLE( PRECISION , ANSWER ) cout << fixed << setprecision( PRECISION ) << ( ANSWER ) << endl; return 0 #define MIN( A , B ) A < B ? A : B; #define MAX( A , B ) A < B ? B : A; template inline T Absolute( const T& a ){ return a > 0 ? a : - a; } int main() { CIN( ll , T ); FOR( i , 0 , T ){ CIN( ll , N ); list p{}; FOR( j , 0 , N ){ CIN( ll , Ai ); auto itr = p.begin() , end = p.end(); while( itr != end ){ ll& pj = *itr; if( Ai % pj == 0 ){ ll count = 1; while( Ai % pj == 0 ){ Ai /= pj; count++; } if( count % 2 == 0 ){ itr = p.erase( itr ); } else { itr++; } } else { itr++; } } ll pj = 2; { if( Ai % pj == 0 ){ ll count = 0; while( Ai % pj == 0 ){ Ai /= pj; count++; } if( count % 2 != 0 ){ p.push_back( pj ); } } pj += 1; } while( Ai != 1 ){ if( Ai % pj == 0 ){ ll count = 0; while( Ai % pj == 0 ){ Ai /= pj; count++; } if( count % 2 != 0 ){ p.push_back( pj ); } } pj += 2; } } if( p.empty() ){ cout << "Yes\n"; } else { cout << "No\n"; } } return 0; }