• + 0 comments
    def check(n,x):
        s = ''
        for i in range(n):
            t = str(x[i])
            s += t
        s = str(s)
        p = list(permutations(s))
        for q in p:
            digit = int(''.join(q))
            if digit%3 ==0:
                return True
            else:
                return False
                
    from itertools import permutations
    for _ in range(int(input())):
        n = int(input())
        x = list(map(int, input().split()))
        print('Yes' if check(n,x) else 'No')