
#include <iostream>
#include <vector>
#include<set>
#include <algorithm>
#include <string>
#include <stack>
#include<queue>
#include<math.h>
#include<numeric>
#include<deque>

using namespace std;

int main() {
	int t;
	cin >> t;
	long long a, b, c;
	long long temp;
	long long counter;
	for (int i = 0; i < t; i++) {
		cin >> a >> b >> c;
		long long res = a + b + c;
		if (res < 9) {
			cout << "NO" << endl;
			continue;
		}
		long long temp = res / 9;
		vector<long long> v;
		v.push_back(a);
		v.push_back(b);
		v.push_back(c);
		sort(v.begin(), v.end());
		counter = v.front();
		if (res % 9 == 0 && counter >= temp) {
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;

	}
}