H,W = map(int,input().split()) for _ in range(H): S = input() T = S.replace("yiwiy9","yiwiY9") U = T.replace("9yiwiy","9Yiwiy") print(U)