#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define PI 3.1415926535898
#define mp make_pair
#define pb push_back

using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// 		tree_order_statistics_node_update> ordered_set;


int ncr(int n, int r) {

	int prod = 1;

	for (int i = n - r + 1; i <= n; i++)
		prod *= i;

	for (int i = r; i >= 1; i--)
		prod /= i;

	return prod;
}


int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int tt;
	cin >> tt;

	while (tt--) {

		int a, b, c;
		cin >> a >> b >> c;
		int sum = a + b + c;

		int num = sum / 9;

		if ((sum % 9) || min(a, min(b, c)) < num) {
			cout << "NO\n";
		}
		else
			cout << "YES\n";
	}

	return 0;
}

