#include <algorithm>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>

using namespace std;
typedef long long ll;
const int maxn = 1e3 + 7;
int a[10];
int main() {
    int T;scanf("%d",&T);
    while(T--) {
        int sum = 0;
        for(int i = 1;i <= 3;i++) {
            scanf("%d",&a[i]);
            sum += a[i];
        }
        if(sum % 9 == 0) {
            if(a[1] >= sum / 9 & a[2] >= sum / 9 && a[3] >= sum / 9) {
                printf("YES\n");
            } else {
                printf("NO\n");
            }
        } else {
            printf("NO\n");
        }
    }
    return 0;
}
	 	  			 	 	  		 	           		