#include #include #include #include #include using namespace std; long long dig(long long x) { long long s=0; while(x) { s+= (x%10); x/=10; } return s; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t; cin>>t; while(t--) { int n; cin>>n; long long sum, x; if(n==1) { cin>>x; if(x%3) cout << "No\n"; else cout << "Yes\n"; continue; } while(n--) { cin>>x; sum+=dig(x); } if(sum%3) cout << "No\n"; else cout << "Yes\n"; } return 0; }