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


int main()
{
    int T;
	scanf("%d",&T);
	while(T--){
        int a, b, c;
        scanf("%d%d%d",&a,&b,&c);
		int sum = a + b + c;
		int p=min(b,c);
		int minx = min(a, p);
		if (sum % 9 == 0 && sum / 9 <= minx) printf("YES\n");
		else puts("NO");
	}

	return 0;
}
