#include<iostream>
using namespace std;
int max_x, max_y;
char maze[105][105];
bool visited[105][105]
bool ans;
void run( int y, int x )
{
if( x < 0 || x >= max_x || y < 0 || y >= max_y || ans == 1 )
return;
if( visited[y][x] == 1 || maze[y][x] == 'x' )
return;
visited[y][x] = 1;
if( maze[y][x] == 'O' )
ans = 1;
run( y-1, x );
run( y+1, x );
run( y, x-1 );
run( y, x+1 );
}
int main()
{
int i, j, start_x, start_y;
while( cin >> max_x >> max_y )
{
for( i = 0 ; i < max_y ; i++ )
for( j = 0 ; j < max_x ; j++ )
{
cin >> map[i][j];
visited[i][j] = 0;
if( maze[i][j] == 'M' )
{
start_y = i;
start_x = j;
}
}
ans = 0;
run( start_y, start_x );
if( ans )
cout << "Yes!" << endl;
else
cout << "Oh, no!" << endl;
}
return 0;
}