#include<bits/stdc++.h> 
#define lion ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(0)
#define ll long long
using namespace std;

int main () {
    lion;
    ll t;
    cin >> t;
    while (t--) {
        ll a, b, c;
        cin >> a >> b >> c;
        ll minn = min(min(a,b),c);
        ll sum = a + b + c;
        if (sum % 9 == 0 && sum/9 <= minn) cout << "YES" << endl; else cout << "NO" << endl;
    }
    return 0;
}
