t = int(input()) for _ in range(t): n = int(input()) a = input().replace(' ', '') print('No' if sum(map(int, a)) % 3 else 'Yes')