#include <iostream>
#include <algorithm>
using namespace std;
void solve() {
int x, y, a;
cin >> x >> y >> a;
if (a % __gcd(x, y) == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBzb2x2ZSgpIHsKICAgIGludCB4LCB5LCBhOwogICAgY2luID4+IHggPj4geSA+PiBhOwoKICAgIGlmIChhICUgX19nY2QoeCwgeSkgPT0gMCkgewogICAgICAgIGNvdXQgPDwgIllFUyIgPDwgZW5kbDsKICAgIH0gZWxzZSB7CiAgICAgICAgY291dCA8PCAiTk8iIDw8IGVuZGw7CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgaW50IHQ7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlICh0LS0pIHsKICAgICAgICBzb2x2ZSgpOwogICAgfQp9Cg==