#include using namespace std; int main() { int t; cin >> t; while (t--) { int n, a, b = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a; while (a) { b += a % 10; a /= 10; } } if (b % 3 == 0) { puts("Yes"); } else { puts("No"); } } }