#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n; cin>>m>>n;
int mahfuj[7][m],nayon[7][n];
for(int i=0;i<7;i++)
{
for(int j=0;j<m;j++) cin>>mahfuj[i][j];
}
for(int i=0;i<7;i++)
{
for(int j=0;j<n;j++) cin>>nayon[i][j];
}
int mxStreakM=0,mxStreakN=0,mxSubM=0,mxSubN=0;
int streak=0,submissions=0;
for(int i=0;i<m;i++)
{
for(int j=0;j<7;j++)
{
if(mahfuj[j][i]==0)
{
if(streak==mxStreakM)
{
mxSubM=max(mxSubM,submissions);
}
else if(streak>mxStreakM)
{
mxStreakM=streak;
mxSubM=submissions;
}
streak=0;
submissions=0;
}
else
{
streak++;
submissions += mahfuj[j][i];
}
}
}
if(streak==mxStreakM)
{
mxSubM=max(mxSubM,submissions);
}
else if(streak>mxStreakM)
{
mxStreakM=streak;
mxSubM=submissions;
}
streak = 0; submissions=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<7;j++)
{
if(nayon[j][i]==0)
{
if(streak==mxStreakN)
{
mxSubN=max(mxSubN,submissions);
}
else if(streak>mxStreakN)
{
mxStreakN=streak;
mxSubN=submissions;
}
streak=0;
submissions=0;
}
else
{
streak++;
submissions += nayon[j][i];
}
}
}
if(streak==mxStreakN)
{
mxSubN=max(mxSubN,submissions);
}
else if(streak>mxStreakN)
{
mxStreakN=streak;
mxSubN=submissions;
}
if(mxStreakM!=mxStreakN)
{
if(mxStreakM>mxStreakN) cout<<"Mahfuz is the boss";
else cout<<"Nayon is the boss";
}
else
{
if(mxSubM>mxSubN) cout<<"Mahfuz is the boss";
else if(mxSubN>mxSubM) cout<<"Nayon is the boss";
else cout<<"No one is the boss";
}
}