#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll t,a,b,c,sum;

int main(){
    cin>>t;
    while(t--){
        cin>>a>>b>>c;
        sum=a+b+c;
        if(sum%9==0&&a>=sum/9&&b>=sum/9&&c>=sum/9){
            cout<<"YES\n";
        }
        else{
            cout<<"NO\n";
        }
    }
    return 0;
}
