#!/bin/python3 T = int(input()) for t in range(T): n = int(input()) x = "".join(input().split()) print("Yes" if sum([int(p) for p in x]) % 3 == 0 else "No")