import math
t = int(input())
for _ in range(t):
a, b, x = map(int, input().split())
if(a > b):
a, b = b, a
if(x > b):
print("NO")
elif(x == a or x == b):
print("YES")
else:
count = 0
gcd = math.gcd(a, b)
while(x <= a and a > gcd):
b_ = b
b = a
a = (b_ % a)
if(x > b):
print("NO")
elif(x == a or x == b):
print("YES")
elif((b - x) % a == 0):
print("YES")
else:
print("NO")
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;
const long long mod = 1000000007;
ll gcd (ll a, ll b) {return b==0 ? a : gcd(b, a%b);}
const unsigned gen_seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
#define all(c) (c).begin(),(c).end()
#define srt(c) sort(all(c))
#define srtrev(c) sort(all(c)); reverse(all(c))
#define forn(i, a, b) for(int i = a; i < b; i++)
#define read(x) scanf("%d", &x)
#define readv(x, n) vll x(n); forn(i,0,n) cin>>x[i]
#define outv(x) forn(i,0,x.size())cout <<x[i]<< " "; cout <<endl
#define yes cout <<"yes\n";
#define no cout <<"no\n";
#define pb push_back
#define mp make_pair
int solve (ll a , ll b , ll x ) {
if ( a==x||b==x ) return 1 ;
if ( a==0 ||b==0 ) return 0 ;
ll k = ( a-x )/b ;
ll q = a/b ;
if ( k>=0 && k*b == (a-x) ) return 1 ;
solve ( b , a%b , x ) ;
}
int main()
{
#ifdef LOCAL
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
#endif
int ta;
scanf("%d\n", &ta);
forn(ifa,0,ta) {
ll a , b , x ; cin>> a >>b>>x ;
if ( x >max (a, b )){
no ;continue;
}
if ( a<b ) swap(a, b ) ;
if ( solve ( a, b , x )){
yes ;
}else no ;
}
}
1031A - Golden Plate | 1559C - Mocha and Hiking |
427B - Prison Transfer | 330A - Cakeminator |
426A - Sereja and Mugs | 363A - Soroban |
1585C - Minimize Distance | 1506E - Restoring the Permutation |
1539A - Contest Start | 363D - Renting Bikes |
1198D - Rectangle Painting 1 | 1023B - Pair of Toys |
1725A - Accumulation of Dominoes | 1675E - Replace With the Previous Minimize |
839A - Arya and Bran | 16B - Burglar and Matches |
1625B - Elementary Particles | 1725G - Garage |
1725B - Basketball Together | 735A - Ostap and Grasshopper |
1183B - Equalize Prices | 1481A - Space Navigation |
1437B - Reverse Binary Strings | 1362B - Johnny and His Hobbies |
1299A - Anu Has a Function | 1111A - Superhero Transformation |
954A - Diagonal Walking | 39F - Pacifist frogs |
1451C - String Equality | 386A - Second-Price Auction |