Scanner scn = new Scanner(System.in);
int Cars = scn.nextInt();
int even = 0;
int odd = 0;
while (Cars > 0) {
int N = scn.nextInt();
while (N > 0) {
int rem = N % 10;
int a = rem % 2;
if (a == 0) {
even += rem;
} else {
odd += rem;
}
N = N / 10;
}
if(even % 4 == 0 || odd % 3 == 0 ) {
System.out.println("Yes");
} else {
System.out.println("No");
}
Cars--;
}