#include <iostream>
#include <cstring>
using namespace std;
int main() {
int t, n, a = 0, m = 0;
string s;
cin >> t;
while (t--) {
a = 0;
m = 0;
cin >> n;
cin >> s;
for (int i = 0; i < n; ++i) {
if (a == 0 && s[i] != 'M' && s[i] != 'm') {
if (s[i] == 'e' || s[i] == 'E') {
++a;
} else {
m = 1;
break;
}
}
}