问题 G: Gcd

内存限制:512 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:9 通过:8

题目描述

Initially, you have a set S={x,y}S=\{x,y\}S={x,y} (x≠y)(x \neq y )(x≠y). Then you have two operations:

∙\bullet 1. Choose two elements a,b(a≠b)a,b (a \neq b)a,b(a≠b) from
set SSS, insert a−ba-bab to the set.

∙\bullet 2. Choose two elements a,b(a≠b)a,b (a \neq b)a,b(ab) from
set SSS, insert gcd⁡(∣a∣,∣b∣)\gcd(|a|,|b|)gcd(a,b) to the set.

We define ∣a∣|a|a as the absolute value of aaa.

We define gcd⁡(a, b)\gcd(a,\ b)gcd(a, b) as the greatest common divisor of aaa and bbb.

Specially, gcd⁡(a, 0)=gcd⁡(0, a)=a\gcd(a, \ 0) = \gcd(0,\ a) = agcd(a, 0)=gcd(0, a)=a.

You task is making z∈Sz \in SzS after several operations.

If possible, print "YES". Otherwise, print "NO".

输入格式

Each test contains multiple test cases. The first line contains the number of test cases TTT(1≤T≤1051 \le T \le 10^51T105).
The description of the test cases follows.
One line contains three integers x,y,zx, y , zx,y,z(0≤x,y,z≤109, x≠y0 \le x, y,z\le 10^9, \ x \neq y0x,y,z109, x≠y).

输出格式

For each test case, output "YES" or "NO".

输入样例 复制

3
2 4 2
2 4 1
5 6 1

输出样例 复制

YES
NO
YES