R=range I=input H,W=map(int,I().split()) for i in R(H): a,p,s="",0,I()+' '; for j in R(W): a+='Y'if'y'==s[j]and'9'==(s[j-1]if j==p+1 else s[j+1]if j==p+4 else"")else s[j] if s[j]=='.'or j-p==5:p=j+1 print(a)