#include <iostream>
using namespace std;
#define ll long long int 
#include<bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(n) for(ll i=0;i<n;i++)
#define repa(a,n) for(ll i=a;i<=n;i++)
#define rrep(n) for(ll i=n-1;i>=0;i--)
#define rrepa(n,a) for(ll i=n;i>=a;i--)
#define tt ll t ;cin>>t;ll pp=t;while(t--)
#define mod 1000000007
#define SIZE 2000000
ll parent[1000009];
ll bit[1000009]; 
int main(){
    IOS
    tt
    { 
      ll a,b,c;
      cin>>a>>b>>c;
      ll sum=a+b+c;
      if(sum%9==0){
          ll m=sum/9;
          if(a>=m&&b>=m&&c>=m)
          cout<<"YES"<<"\n";
          else
          cout<<"NO"<<"\n";
      }
      else
      cout<<"NO"<<"\n";

    }
    
  
	return 0;
}