#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    int t;
    cin>>t;
    while(t--){
        int a, b, c;
        cin>>a>>b>>c;
        int tot = a+b+c;
        int mn = min({a, b, c});
        if(tot % 9 ==0 and (tot/9) <= mn) cout<<"YES\n";
        else cout<<"NO\n";
    }
}