import sys
sys.setrecursionlimit(10**6)
h,w=map(int,input().split())
c=[list(input()) for i in range(h)]
dxy=((0,1),(0,-1),(1,0),(-1,0))
def dfs(y,x):
    c[y][x]="#"
    for dx,dy in dxy:
        nx,ny=x+dx,y+dy
        if 0<=nx<=w-1 and 0<=ny<=h-1 and (c[ny][nx]=="." or c[ny][nx]=="g"):
            dfs(ny,nx)
    return       
for i in range(w):
    for j in range(h):
        if c[j][i]=="s":
            dfs(j,i)
for i in range(w):
    for j in range(h):
        if c[j][i]=="g":
            print("No")
            sys.exit()
print("Yes")

