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