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

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