时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld
题目描述
You have an array of

elements

.
For each task, you have three integers

.
Ask whether you can find an array

of

integers satisfy:
Specially, if

, it should satisfy
)
is
the multiply of
If possible, print "YES". Otherwise, print "NO".
输入描述:
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 contains two integers
(
).
The second line contains
integers
(
).
Each of the next
lines contains three integers
(
).
It's guaranteed that 
输出描述:
For each test case, output "YES" or "NO".
示例1
输入
复制
2
3 3
1 2 3
1 2 1
1 3 1
2 3 1
3 3
2 2 2
1 2 1
1 2 2
1 2 3