import sys input = sys.stdin.readline H,W=map(int,input().split()) S=[input().strip() for i in range(H)] Q=[(0,0)] ANS=[S[0][0]] while Q: D=dict() while Q: x,y=Q.pop() for z,w in [(x+1,y),(x,y+1)]: if 0<=z