#include <stdio.h>
// Function to find the possible winner of the game
char* find_winner(int N, char* rounds) {
int mahfuz_points = 0;
int emon_points = 0;
int k = 0;
for (int i = 0; i < N; i++) {
char round_result = rounds[i];
if (round_result == 'M') {
mahfuz_points += 1;
} else if (round_result == 'E') {
emon_points += 1;
} else { // round_result == '?'
k += 1;
}
if (mahfuz_points >= k && mahfuz_points >= emon_points) {
return "Mahfuz";
} else if (emon_points >= k && emon_points > mahfuz_points) {
return "Emon";
}
}
return "IDK";
}
int main() {
int N;
scanf("%d", &N);
char rounds[N + 1];
scanf("%s", rounds);
// Output
char* winner = find_winner(N, rounds);
printf("%s\n", winner);
return 0;
}