/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;

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