for case in range(int(input())): n=int(input()) a=list(map(int,input().split())) sm=sum(a) if sm%3==0: print ("Yes") else: print ("No")