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