#include <bits/stdc++.h>
using namespace std;
int t;
string s;
string check(){
if (s.size() % 2 != 0) return "NO";
int d = 0;
for (int i = 0; i < s.size() / 2; i++)
d += s[i];
for (int i = s.size() / 2; i < s.size(); i++)
d -= s[i];
return (d == 0 ? "YES" : "NO");
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >>t;
while (t--){
cin >>s;
cout <<check() <<'\n';
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgdDsKc3RyaW5nIHM7CgpzdHJpbmcgY2hlY2soKXsKICAgIGlmIChzLnNpemUoKSAlIDIgIT0gMCkgcmV0dXJuICJOTyI7CiAgICBpbnQgZCA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IHMuc2l6ZSgpIC8gMjsgaSsrKQogICAgICAgIGQgKz0gc1tpXTsKICAgIGZvciAoaW50IGkgPSBzLnNpemUoKSAvIDI7IGkgPCBzLnNpemUoKTsgaSsrKQogICAgICAgIGQgLT0gc1tpXTsKICAgIHJldHVybiAoZCA9PSAwID8gIllFUyIgOiAiTk8iKTsKfQoKaW50IG1haW4oKXsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKICAgIGNpbiA+PnQ7CiAgICB3aGlsZSAodC0tKXsKICAgICAgICBjaW4gPj5zOwogICAgICAgIGNvdXQgPDxjaGVjaygpIDw8J1xuJzsKICAgIH0KICAgIHJldHVybiAwOwp9