#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 2000009
#define mx 10000000000008
#define mod 1000000007
ll n,t,arr[sz+10],brr[sz+10],crr[sz+10];
vector<ll>v;
int main()
{
  scanf("%lld",&t);
  while(t--)
  {
      ll a,b,c;
      scanf("%lld %lld %lld",&a,&b,&c);
      n=(a+b+c)%9ll;
      ll m=(a+b+c)/9;
      ll k=min(a,min(b,c));
      if(n==0 && k>=m)
        printf("YES\n");
      else
        printf("NO\n");
      //printf("%s\n",n?"NO":"YES");
  }
  return 0;
}
