#include<iostream>
using namespace std;
void sort()
{
	int a, b, c,d,e;
	cin >> a >> b >> c;
	d = (a + b + c) % 9;
	e = (a + b + c) / 9;
	if (d != 0)
	{
		cout << "NO" << endl;
		return;
	}
	if(a<e || b<e || c<e)
	{
		cout << "NO" << endl;
		return;
	}
	else
	{
		cout << "YES" << endl;
		return;
	}
}
int main()
{
	int n;
	cin >> n;
	while (n--)
		sort();
	return 0;
}