#P1975B. 378QAQ and Mocha's Array
378QAQ and Mocha's Array
No submission language available for this problem.
Description
Mocha likes arrays, so before her departure, 378QAQ gave her an array consisting of positive integers as a gift.
Mocha thinks that is beautiful if there exist two numbers and (, ) such that for all (), is divisible by either or .
Determine whether is beautiful.
is divisible by if there exists an integer such that .
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers () — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output "Yes" if array is beautiful, and output "No" otherwise.
You can output "Yes" and "No" in any case (for example, strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive response).
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers () — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output "Yes" if array is beautiful, and output "No" otherwise.
You can output "Yes" and "No" in any case (for example, strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive response).
Note
In the first test case, any two numbers in the array are coprime, so the answer is "No".
In the second test case, we can pick and . Since every number in the array is divisible by , the answer is "Yes".
In the third test case, we can pick and . and is divisible by while , and is divisible by , so the answer is "Yes".