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

int main()
{
    int t;
    cin >> t;

    for (int I = 0 ; I < t ; ++I)
    {
        int arr[3];
        cin >> arr[0] >> arr[1] >> arr[2];

        long long heal = arr[0] + arr[1] + arr[2];

        if (heal % 9)
        {
            cout << "NO\n";
            continue;
        }

        long long n = heal / 9.0;

        if (*min_element(arr, arr + 3) >= n)
            cout << "YES\n";
        else
            cout << "NO\n";

    }


    return 0;
}
