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