#include #include #include #include #include using namespace std; int main() { int t, n; string st, s; cin >> t; while(t--){ st.clear(); cin >> n; int tmp = 0; for(int i = 1; i <= n; i++) {cin >> s; st += s;} for(int i = 0; i < st.length(); i++) tmp += st[i] - 0; if(tmp % 3 == 0) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }