#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void solve(int cs) {
int n, m;
cin >> m >> n;
vector<vector<int>> M(7, vector<int>(m)), N(7, vector<int>(n));
for (int i = 0; i < 7; i++) {
for (int j = 0; j < m; j++) {
cin >> M[i][j];
}
}
for (int i = 0; i < 7; i++) {
for (int j = 0; j < n; j++) {
cin >> N[i][j];
}
}
pair<int, int> mah = {0, 0}, nay = {0, 0};
int64_t cnt = 0, sum = 0;
;
for (int j = 0; j < m; j++) {
for (int i = 0; i < 7; i++) {
if (M[i][j] > 0) {
sum += M[i][j], cnt += 1;
} else {
if (mah.first < cnt) {
mah.first = cnt, mah.second = sum;
} else if (mah.first == cnt) {
if (mah.second < sum) {
mah.second = sum;
}
}
sum = 0, cnt = 0;
}
}
}
if (mah.first < cnt) {
mah.first = cnt, mah.second = sum;
} else if (mah.first == cnt) {
if (mah.second < sum) {
mah.second = sum;
}
}
sum = 0, cnt = 0;
for (int j = 0; j < n; j++) {
for (int i = 0; i < 7; i++) {
if (N[i][j] > 0) {
sum += N[i][j], cnt += 1;
} else {
if (nay.first < cnt) {
nay.first = cnt, nay.second = sum;
} else if (nay.first == cnt) {
if (nay.second < sum) {
nay.second = sum;
}
}
sum = 0, cnt = 0;
}
}
}
if (nay.first < cnt) {
nay.first = cnt, nay.second = sum;
} else if (nay.first == cnt) {
if (nay.second < sum) {
nay.second = sum;
}
}
if (mah.first > nay.first || (mah.first == nay.first && mah.second > nay.second))
cout << "Mahfuz is the boss\n";
else if (nay.first > mah.first || (nay.second > mah.second && nay.first == mah.first))
cout << "Nayon is the boss\n";
else
cout << "No one is the boss\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc = 1;
// cin >> tc;
for (int cs = 1; cs <= tc; cs++) {
solve(cs);
}
return 0;
}