import sys sys.setrecursionlimit(10**7) def ii(): return int(input()) def ist(): return input().split() def mi(d=0): return map(lambda x:int(x)-d,input().split()) def lmi(d=0): return list(map(lambda x:int(x)-d,input().split())) INF = float("inf") def answer(s): print(s) exit() ################################################ yiwiy = list("yiwiy") h,w = mi() s = [list(input()) for _ in range(h)] for i in range(h): for j in range(w): if s[i][j] == "9": if j-5 >= 0 and s[i][j-5:j] == yiwiy: s[i][j-1] = "Y" elif j+5 <= w and s[i][j+1:j+6] == yiwiy: s[i][j+1] = "Y" for ss in s: print("".join(ss))