An array a is called beautiful if for every pair of numbers a_i , a_j , (i \neq j ), there exists an a_k  such that a_k = a_i * a_j . Note that k can be equal to i or j too.


First line of the input contains an integer T denoting the number of test cases. T test cases follow. First line of each test case contains an integer n denoting number of elements in a. Next line contains n space separated integers denoting the array a.


For each test case, output a single line containing “yes” or “no” (without quotes) corresponding to the answer of the problem.

Approach 1: Naive


Approach 2: Advanced



GitLab Repository:

Problem found at :

Write A Comment