#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
    int t,a[3],k;
    cin>>t;
    while(t--){
     cin>>a[0]>>a[1]>>a[2];
     sort(a,a+3);
     k=a[0]+a[2]+a[1];
     if(k%9==0){
         if(a[0]>=k/9){
             cout<<"YES"<<endl;
         }
         else{
         cout<<"NO"<<endl;
     }

     }
     else{
         cout<<"NO"<<endl;
     }

    }
    return 0;
}