#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 7;
int a, b, c;
bool check(int m) {
    int x = m / 7;
    int na = max(0, a - x);
    int nb = max(0, b - x);
    int nc = max(0, c - x);
    return na + nb + nc <= m - x;
}
int main() {
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        cin >> a >> b >> c;
        int sum = a + b + c;
        if (sum % 9) {
            printf("NO\n");
            continue;
        }
        int x = sum / 9 - 1;
        if (min(a, min(b, c)) <= x) printf("NO\n");
        else printf("YES\n");
    }
    return 0;
}
