from typing import List, Tuple
def solve():
m, n = map(int, input().split())
mm = [list(map(int, input().split())) for _ in range(7)]
nn = [list(map(int, input().split())) for _ in range(7)]
m_sum, n_sum = 0, 0
vectm, vectn = [], []
m_cnt, n_cnt = 0, 0
for i in range(m):
for j in range(7):
if mm[j][i] != 0:
m_cnt += 1
m_sum += mm[j][i]
else:
vectm.append((m_cnt, m_sum))
m_cnt, m_sum = 0, 0
vectm.append((m_cnt, m_sum))
for i in range(n):
for j in range(7):
if nn[j][i] != 0:
n_cnt += 1
n_sum += nn[j][i]
else:
vectn.append((n_cnt, n_sum))
n_cnt, n_sum = 0, 0
vectn.append((n_cnt, n_sum))
vectm.sort()
vectn.sort()
if vectm[-1][0] > vectn[-1][0]:
print("Mahfuz is the boss")
elif vectm[-1][0] < vectn[-1][0]:
print("Nayon is the boss")
else:
if vectm[-1][1] > vectn[-1][1]:
print("Mahfuz is the boss")
elif vectm[-1][1] < vectn[-1][1]:
print("Nayon is the boss")
else:
print("No one is the boss")
def main():
fast = lambda: None
# debug()
TestCase = 1
# TestCase = int(input())
while TestCase:
solve()
TestCase -= 1
if __name__== "__main__":
main()