#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- int N; //--------------------------------------------------------------------------------------------------- void solve() { cin >> N; int sm = 0; rep(i, 0, N) { int x; cin >> x; while (x) { sm += x % 10; x /= 10; } } if (sm % 3 == 0) printf("Yes\n"); else printf("No\n"); } //--------------------------------------------------------------------------------------------------- void _main() { int T; cin >> T; rep(t, 0, T) solve(); }