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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	int n;
	cin >> n;
	while (n--) {
		int t;
		cin >> t;
		int r = 0;
		while (t--) {
			int x;
			cin >> x;
			r += x % 3;
		}

		cout << (r%3 ? "No\n" : "Yes\n");
	}
}