// We are the ones that rule the world now
// You are entrapped by blind inanity
// There is no way that you'll revoke your decision
// Now look for distraction

#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main() {
	int t;
	scanf("%d", &t);

	while (t--) {
		int n, ans = 0;
		scanf("%d", &n);

		for (int i = 0; i < n; i++) {
			int x;
			scanf("%d", &x);

			ans += x;
			ans %= 3;
		}

		puts(ans == 0 ? "Yes" : "No");
	}
}