h,w = map(int,input().split()) s = [list(input()) for _ in range(h)] if w > 5: for i in range(h): k = 0 for j in range(w-5): j += k if j + 5 >= w: break if s[i][j] == "9" and s[i][j+1] == "y" and s[i][j+2] == "i" and s[i][j+3] == "w" and s[i][j+4] == "i" and s[i][j+5] == "y": s[i][j+1] = "Y" k += 5 if s[i][j] == "y" and s[i][j+1] == "i" and s[i][j+2] == "w" and s[i][j+3] == "i" and s[i][j+4] == "y" and s[i][j+5] == "9": s[i][j+4] = "Y" k += 5 for A in s: t = "" for B in A: t += B print(t)