import sys input = sys.stdin.readline from collections import deque H,W=map(int,input().split()) MAP=[input().strip() for i in range(H)] DX=[[1<<60]*W for i in range(H)] DY=[[1<<60]*W for i in range(H)] DX[0][0]=0 DY[0][0]=0 Q=deque([(0,0)]) while Q: x,y=Q.popleft() for z,w in [(x+1,y),(x-1,y)]: if 0<=zDY[x][y] or (DY[z][w]==DY[x][y] and DX[z][w]>DX[x][y]+1): DY[z][w]=DY[x][y] DX[z][w]=DX[x][y]+1 Q.appendleft((z,w)) for z,w in [(x,y+1),(x,y-1)]: if 0<=zDY[x][y]+1 or (DY[z][w]==DY[x][y] and DX[z][w]>DX[x][y]): DY[z][w]=DY[x][y]+1 DX[z][w]=DX[x][y] Q.append((z,w)) if DY[-1][-1]>1<<30: print("No") else: print("Yes") print(DY[-1][-1],DX[-1][-1])