#include using namespace std; #define MAX 10 // max size of a number = 10^9 string canConstruct(vector a) { // Return "Yes" or "No" denoting whether you can construct the required number. int temp, sum = 0; char s[2] = {0}; for ( int i = 0; i < a.size(); i++ ) { char str[10] = {0}; sprintf(str, "%d", a[i]); for ( int j = 0; str[j] != (char)NULL; j++ ) { s[0] = str[j]; s[1] = (char)NULL; // NULL termianted string sscanf(s, "%d", &temp); //sscanf(&str[j], "%d", &temp); // silly sum += temp; //cout << "adding " << temp << endl; } } //cout << sum << endl; if ( sum%3 == 0 ) return "Yes"; else return "No"; } int main() { int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } string result = canConstruct(a); cout << result << endl; } return 0; }