#include using namespace std; int isMultipleOf3(int n) { int odd_count = 0; int even_count = 0; if(n < 0) n = -n; if(n == 0) return 1; if(n == 1) return 0; while(n) { if(n & 1) odd_count++; n = n>>1; if(n & 1) even_count++; n = n>>1; } return isMultipleOf3(abs(odd_count - even_count)); } string canConstruct(vector a) { vector::iterator it; int sum=0,temp=0; for(it=a.begin();it!=a.end();it++){ if(isMultipleOf3(*it)%3==0) temp+=(*it); } if(temp%3==0) return "Yes"; return "No"; } int main() { int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } string result = canConstruct(a); cout << result << endl; } return 0; }