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

#define all(x) 						(x).begin(), (x).end()
#define acarr(arr, n, type)   		type *arr=new type[n]; for(long long i=0; i<n; ++i) cin >> arr[i];
#define ll							long long
#define TF(ok)						cout << (ok ? "YES\n" : "NO\n")
#define ld							long double
#define vi							vector<int> v1
#define pb							push_back

int solve(){
	
	ll ans=0, tab=0;

	vector<int> v1(3);
	for (int i=0; i<3; i++){
		cin >> v1[i];
		ans+=v1[i];
	}

	if (ans%9==0){
		tab= ans/9;
		for (int i=0; i<3; i++){
			if (v1[i]<tab){
				cout << "NO\n" ;
				return 0;
			}
		}
		cout << "YES\n";
	}
	else{
		cout << "NO\n" ;
	}


	return 0;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int q; 
	q=1;
cin >> q;
	while(q--){
		solve();
	}

	return 0;
}

/*   ~ Check for overflow
	~ Division by 0
	~ Uninitialized
	~
*/
