// 6/17/2026
// Solution to Kattis Problem: Simple Factoring
// https://open.kattis.com/problems/simplefactoring

using namespace std;
#include <bits/stdc++.h>
typedef long long ll;

vector<ll> getDiv(ll n);

int main() {

    // Get data, use a string for the middle item.
    int nC;
    cin >> nC;

    // Process cases.
    for (int loop=0; loop<nC; loop++) {

        ll a, b, c;
        cin >> a >> b >> c;

        // Get divisors of a and c, so we can brute force d and e...
        vector<ll> divA = getDiv(a);
        vector<ll> divC = getDiv(c);

        // No solution yet.
        bool ok = false;

        // Loop through each pair.
        for (ll d : divA) {
            for (ll e: divC) {

                // Calculate this factoring.
                ll f = a/d;
                ll g = c/e;

                // See if the middle term works.
                ll mid = e*f + d*g;
                if (mid == b) {
                    ok = true;
                    break;
                }
            }
            if (ok) break;
        }

        // Output accordingly.
        if (ok) cout << "YES" << endl;
        else    cout << "NO" << endl;
    }

    return 0;
}

// Returns divisors of n (not sorted).
vector<ll> getDiv(ll n) {

    // Store answers here.
    vector<ll> res;

    // Try all smaller divisors.
    for (ll i=1; i*i<=n; i++) {

        // Found 1 or 2 divisors, add them.
        if (n%i == 0) {
            res.push_back(i);
            if (n/i != i) res.push_back(n/i);
        }
    }

    return res;
}
