#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) (vec).begin(),(vec).end()
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int T,a,b,c;
void solve(){
	cin>>a>>b>>c;
	if((a+b+c)%9!=0){cout<<"NO"<<endl;return;}
	int round=(a+b+c)/9;
	if(min(a,min(b,c))<round){cout<<"NO"<<endl;return;}
	cout<<"YES"<<endl;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>T;
	while(T--) solve();
	return 0;
}
