#include using namespace std; int main () { int t; cin >> t; while (t --) { int n; cin >> n; int ans = 0; for (int i = 1;i <= n;i ++) { int x; cin >> x; while (x) { ans += (x % 10); x /= 10; } } if (ans % 3 == 0) cout << "Yes"; else cout << "No"; cout << endl; } return 0; }