import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static String canConstruct(int i) { // Return "Yes" or "No" denoting whether you can construct the required number. if(i%3==0) return "Yes"; else { return "No"; } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); int sum=0; int[] sumr=new int[t]; for(int a0 = 0; a0 < t; a0++){ int n = in.nextInt(); int[] a = new int[n]; sum=0; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextInt(); if(a[a_i]<10) sum=sum+a[a_i]; if(a[a_i]>=10 && a[a_i]<100) { sum=sum+a[a_i]%10; sum=sum+((a[a_i])/10)%10; } if(a[a_i]==100) { sum=sum+a[a_i]%10; sum=sum+((a[a_i])/10)%10; sum=sum+((a[a_i])/100)%10; } } sumr[a0]=sum; String result = canConstruct(sumr[a0]); System.out.println(result); } in.close(); } }