#d2561. 变成相同的数

变成相同的数

Making Equal Numbers

Problem Description

You are given nn integers. You may perform any number of operations, each time choosing one number and multiplying it by 22 or by 33. Determine whether you can make all nn numbers equal.

Input Format

The first line contains an integer TT, the number of test cases.

The next TT lines: each line begins with an integer nn, followed by nn integers.

Output Format

For each test case, output YES or NO.

Sample Input

2
4 75 150 75 50
3 100 150 250

Sample Output

YES
NO

Constraints

  • 1≤T≤1001 \le T \le 100
  • 1≤n≤2×1051 \le n \le 2 \times 10^5
  • 1≤ai≤1091 \le a_i \le 10^9
  • ∑i=1Tn≤2×105\sum_{i=1}^{T} n \le 2 \times 10^5