#!/bin/python import sys import itertools def canConstruct(a): flag="No" for i in range(1,len(a)+1): l=list(itertools.combinations(a,i)) for e in l: if((int("".join(map(str,e))))%3==0): flag="Yes" break if(flag=="Yes"): break return flag 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