H, W = map(int, input().split()) S = [list(input()) for _ in range(H)] for i in range(H): idx = 0 while idx < W-5: if S[i][idx:idx+6] == list("yiwiy9"): S[i][idx+4] = "Y" idx += 6 elif S[i][idx:idx+6] == list("9yiwiy"): S[i][idx+1] = "Y" idx += 6 else: idx += 1 for s in S: print("".join(s))