H, W = map(int, input().split()) res = [] for h in range(H): S = input() S = S.replace("yiwiy9", "yiwiY9") S = S.replace("9yiwiy", "9Yiwiy") res.append(S) # print(S) for h in range(H): print(res[h])