#include<bits/stdc++.h>
#include<stdio.h>
#define mx 1000005
using namespace std;
void solve()
{
     int a[5],tot=0,mn=INT_MAX;
     for(int i=0;i<3;i++){
          scanf("%d",&a[i]);
          tot+=a[i];
          mn=min(mn,a[i]);
     }
     int ans=tot/9;
   if(tot%9==0 and mn>=ans)  puts("YES");
   else puts("NO");
}


int main()
{
     int t; scanf("%d",&t);
     while(t--){
          solve();
     }
}
