# include using namespace std; typedef long long ll; typedef long double ld; typedef pair < int, int > pii; const int inf = (int)1e9 + 7; const int N = (int)1e6 + 7; int t; int main(){ scanf("%d", &t); for(int i = 1; i <= t; ++i){ int n; scanf("%d", &n); int sum = 0; for(int j = 1; j <= n; ++j){ int x; scanf("%d", &x); sum += x; sum %= 3; } if(!sum){ printf("Yes\n"); } else{ printf("No\n"); } } return 0; }