#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[]) {
  int T;
  cin >> T;
  while (T--) {
    int n, S = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      int t;
      cin >> t;
      while (t) S += t % 10, t /= 10;
    }
    cout << (S % 3 ? "No" : "Yes") << endl;
  }
  return 0;
}