def find_winner(N, rounds):
mahfuz_points = 0
emon_points = 0
k = 0
for round_result in rounds:
if round_result == 'M':
mahfuz_points += 1
elif round_result == 'E':
emon_points += 1
else: # round_result == '?'
k += 1
if mahfuz_points >= k and mahfuz_points >= emon_points:
return "Mahfuz"
elif emon_points >= k and emon_points > mahfuz_points:
return "Emon"
return "IDK"
def main():
N = int(input("Enter the number of rounds: "))
rounds = input("Enter the results of each round: ").strip()
winner = find_winner(N, rounds)
print(winner)
if __name__ == "__main__":
main()