#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
string target = "Timur";
sort(target.begin(), target.end());
while (t--) {
int n;
string s;
cin >> n >> s;
if (n != 5) {
cout << "NO\n";
continue;
}
sort(s.begin(), s.end());
if (s == target)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGludCB0OwogICAgY2luID4+IHQ7CgogICAgc3RyaW5nIHRhcmdldCA9ICJUaW11ciI7CiAgICBzb3J0KHRhcmdldC5iZWdpbigpLCB0YXJnZXQuZW5kKCkpOwoKICAgIHdoaWxlICh0LS0pIHsKICAgICAgICBpbnQgbjsKICAgICAgICBzdHJpbmcgczsKICAgICAgICBjaW4gPj4gbiA+PiBzOwoKICAgICAgICBpZiAobiAhPSA1KSB7CiAgICAgICAgICAgIGNvdXQgPDwgIk5PXG4iOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgoKICAgICAgICBzb3J0KHMuYmVnaW4oKSwgcy5lbmQoKSk7CgogICAgICAgIGlmIChzID09IHRhcmdldCkKICAgICAgICAgICAgY291dCA8PCAiWUVTXG4iOwogICAgICAgIGVsc2UKICAgICAgICAgICAgY291dCA8PCAiTk9cbiI7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K