#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
int t;
scanf("%d", &t);
while (t-- != 0) {
int n, freq[26] = { };
char s[21];
scanf("%d%s", &n, s);
for (int i = 0; i < n; ++i)
++freq[s[i] - 'a'];
int odd = 0;
for (int i = 0; i < 26; ++i)
if ((freq[i] & 1) == 1)
++odd;
if (odd > 1) {
puts("0");
continue;
}
string z = "";
for (int i = 0; i < 26; ++i)
z += string(freq[i] >> 1, char(i + 'a'));
int res = 0;
do {
++res;
} while (next_permutation(z.begin(), z.end()));
printf("%d\n", res);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpIHsKCWludCB0OwoJc2NhbmYoIiVkIiwgJnQpOwoJd2hpbGUgKHQtLSAhPSAwKSB7CgkJaW50IG4sIGZyZXFbMjZdID0geyB9OwoJCWNoYXIgc1syMV07CgkJc2NhbmYoIiVkJXMiLCAmbiwgcyk7CgkJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCgkJCSsrZnJlcVtzW2ldIC0gJ2EnXTsKCQlpbnQgb2RkID0gMDsKCQlmb3IgKGludCBpID0gMDsgaSA8IDI2OyArK2kpCgkJCWlmICgoZnJlcVtpXSAmIDEpID09IDEpCgkJCQkrK29kZDsKCQlpZiAob2RkID4gMSkgewoJCQlwdXRzKCIwIik7CgkJCWNvbnRpbnVlOwoJCX0KCQlzdHJpbmcgeiA9ICIiOwoJCWZvciAoaW50IGkgPSAwOyBpIDwgMjY7ICsraSkKCQkJeiArPSBzdHJpbmcoZnJlcVtpXSA+PiAxLCBjaGFyKGkgKyAnYScpKTsKCQlpbnQgcmVzID0gMDsKCQlkbyB7CgkJCSsrcmVzOwoJCX0gd2hpbGUgKG5leHRfcGVybXV0YXRpb24oei5iZWdpbigpLCB6LmVuZCgpKSk7CgkJcHJpbnRmKCIlZFxuIiwgcmVzKTsKCX0KCXJldHVybiAwOwp9