H, W = map(int, input().split()) S = [list(input()) for _ in range(H)] for i in range(H): for j in range(W): A = S[i][j : (j + 6)] if "".join(A) == "yiwiy9": S[i][j + 4] = S[i][j + 4].upper() if "".join(A) == "9yiwiy": S[i][j + 1] = S[i][j + 1].upper() for s in S: print(*s, sep="")