#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

bool solve() {
    int n = 3;
    vector<int> a(n);
    for(auto &e : a) cin >> e;

    sort(a.begin(), a.end());
    int sum = accumulate(a.begin(), a.end(), 0LL);

    if(sum % 9) return false;
    int t = sum / 9;

    return a[0] >= t;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t; cin >> t;
    while(t--) cout << (solve() ? "YES" : "NO") << '\n';
    return 0;
}
