#include using namespace std; int main() { int t; scanf("%d", &t); while (t--){ int n, sum = 0; scanf("%d", &n); while (n--){ int temp; scanf("%d", &temp); while (temp){ sum += temp%10; temp /= 10; } } if (sum%3 == 0) printf("Yes\n"); else printf("No\n"); } return 0; }