#include using namespace std; int main() { int t, n; long long int sum, temp; cin >> t; while(t--) { cin >> n; while(n--) { cin >> temp; sum += temp; } if(temp % 3 == 0 || temp % 9 == 0) cout << "Yes" << endl; else cout << "No" << endl; } }