#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <fstream>
#include <bitset>
#include <cassert>
#include <functional>
#include <cstring>
#include <ctime>
#include <cmath>
#include <set>
#include <map>
#include <algorithm>
#define sec second
#define fir first
#define pb push_back
#define mp make_pair
#define REP(i , n) for (int i = 0 ; i < (n) ; i++)
#define BACK(i , n) for (int i = (n) - 1 ; i >= 0 ; i--)
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int , int>;
using ll = long long;
using ld = long double;
const int MAX = 1e9 , MIN = - MAX , MOD = 1e9 + 7;
const ll MAX_LL = 1e18 , MIN_LL = -MAX_LL;
int main(){
    int T;
    cin >> T;
    while(T--){
        int a , b , c , turn;
        cin >> a >> b >> c;
        turn = min(a , min(b , c));
        if ((a + b + c) % 9)
            cout << "NO\n";
        else{
            if (turn < (a + b + c) / 9)
                cout << "NO\n";
            else
                cout << "YES\n";
        }
    }
}
