import sys input = sys.stdin.readline T=int(input()) from collections import defaultdict for t in range(T): N=int(input()) A=list(map(lambda x:-int(x),input().split())) cnt = defaultdict(int) for a in A: cnt[a%3]+=1 print("Yes" if cnt[1]%3==0 and cnt[2]%3==0 else "No")