#include <iostream>
using namespace std;
int main() {
// SAYED AL MAMUN_LU
int n, sum = 0, sum1 = 0, sum2 = 0, i;
cin >> n;
char samp[n];
cin >> samp;
for (i = 0; i < n; i++) {
if (samp[i] == 'M') {
sum++;
} else if (samp[i] == 'E') {
sum1++;
} else if (samp[i] == '?') {
sum2++;
}
}
if (sum > sum1 && sum > sum2) {
cout << "Mahfuz" << endl;
}
else if (sum1 > sum && sum1 > sum2) {
cout << "Emon" << endl;
}
else if (sum2 > 0) {
if (sum > sum1) {
cout << "Mahfuz" << endl;
}
else if (sum1 > sum) {
cout << "Emon" << endl;
}
else {
cout << "IDK" << endl;
}
}
else {
cout << "IDK" << endl;
}
return 0;
}