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

#define ll long long
#define ld long double
#define vl vector<ll>
#define vvl vector<vl>
#define sz(v) ((ll) v.size())
#define all(v) v.begin(), v.end()

void solve() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll sum = a + b + c;
	if(sum % 9 == 0 && a >= sum/9 && b >= sum/9 && c >= sum/9)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

int main() {
    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
    int tc; cin >> tc; while(tc--)
    solve();
    return 0;
}