#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

void solve()

{

ll k,a,b;

cin>>k>>a>>b;

ll c=(a+b)%10;

ll sum=0;

sum = sum + a+b+c;

k=k-3;

ll d= (2*(a+b))%10;

ll e= (4*(a+b))%10;

ll f= (8*(a+b))%10;

ll temp=k/4;

ll j=k%4;

if(j==1)

{

sum+=d;

}

else if(j==2)

{

sum+=d+e;

}

else if(j==3)

{

sum+=d+e+f;

}

sum+= (temp*20);

cout<<sum<<endl;

if(sum%3==0)

{

```
cout<<"YES"<<"\n";
```

}

else

{

cout<<“NO”<<"\n";

}

}

int main()

{

ll t;

cin>>t;

while(t–)

{

solve();

}

}