#!/bin/python import sys def canConstruct(a): # a number is divisible by 3 if sum of the digits is divisible by 3 # find sum of the digits total = 0 for number in a: # convert number to a list of digits total += sum(map(int, list(str(number)))) return 'Yes' if total % 3 ==0 else 'No' if __name__ == "__main__": t = int(raw_input().strip()) for a0 in xrange(t): n = int(raw_input().strip()) a = map(int, raw_input().strip().split(' ')) result = canConstruct(a) print result