#include <iostream>
#include<algorithm>
using namespace std;
int main() {
int M, N;
cin >> M >> N;
int m[M][7], n[N][7];
for (int i = 0; i < M; i++) {
for (int j = 0; j < 7; j++) {
cin >> m[i][j];
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < 7; j++) {
cin >> n[i][j];
}
}
int msm = 0, msn = 0,summ=0,sumn=0;
for (int i = 0; i < M; i++) {
int c_streak=0;
for (int j = 0; j < 7; j++) {
if (m[i][j] != 0) {
summ=summ+m[i][j];
c_streak++;
} else {
msm = max(msm, c_streak);
c_streak = 0;
}
}
msm = max(msm, c_streak);
}
for (int i = 0; i < N; i++) {
int c_streak=0;
for (int j = 0; j < 7; j++) {
if (n[i][j] != 0) {
c_streak++;
sumn=sumn+n[i][j];
} else {
msn = max(msn, c_streak);
c_streak = 0;
}
}
msn = max(msn, c_streak);
}
if (msm > msn && summ>sumn) {
cout << "Mahfuz is the boss";
} else if (msn > msm && sumn>summ) {
cout << "Nayon is the boss";
} else {
cout << "No one is the boss";
}
return 0;
}