import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner ins = new Scanner(System.in); int T = ins.nextInt(); for(int t = 0; t < T; ++t) { int N = ins.nextInt(); int s = 0; for(int n = 0; n < N; ++n) { int v = ins.nextInt(); while(v > 0) { s += v % 10; v /= 10; } } System.out.println(s % 3 == 0 ? "Yes" : "No"); } } }