← Home
write a go solution for Description:
You are given a pair of integers (a,b) and an integer x.

You can change the pair in two different ways:

- set (assign) a:=|a-b|;
- set (assign) b:=|a-b|,

The pair (a,b) is called x-magic if x is obtainable either as a or as b using only the given operations (i.e. the pair (a,b) is x-magic if a=x or b=x after some number of operations applied). You can apply the operations any number of times (even zero).

Your task is to find out if the pair (a,b) is x-magic or not.

You have to answer t independent test cases.

Input Format:
The first line of the input contains one integer t (1<=t<=10^4) — the number of test cases. The next t lines describe test cases.

The only line of the test case contains three integers a, b and x (1<=a,b,x<=10^18).

Output Format:
For the i-th test case, print YES if the corresponding pair (a,b) is x-magic and NO otherwise.

Note:
None. Output only the code with no comments, explanation, or additional text.