/**
* author: shafi
* created: 06.03.2024 17.36.23
**/
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define ull unsigned long long int
int main(){
ios :: sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
string str;
cin>>str;
int m = count(str.begin(),str.end(),'M');
int e = count(str.begin(),str.end(),'E');
int idk = count(str.begin(),str.end(),'?');
m += idk;
e += idk;
if(m>e){
cout<<"Mahfuz\n";
}
else if(e>m){
cout<<"Emon\n";
}
else{
cout<<"IDK\n";
}
return 0;
}