/* In the name of Allah */ #include using namespace std; #define X first #define Y second #define pb push_back #define mp make_pair #define Size(x) ((int)(x).size()) #define Precision(i) cout << fixed << setprecision(i) typedef long long ll; typedef long double ld; typedef pair pii; int main() { ios_base :: sync_with_stdio(false), cin.tie(0), cout.tie(0); int t; cin >> t; while(t--) { int n; cin >> n; int sum = 0; while(n--) { string s; cin >> s; for(auto i : s) sum += i - '0', sum %= 3; } if(sum) cout << "No\n"; else cout << "Yes\n"; } return 0; }