def replace(s: str) -> str: res = [] t = s xs = [('9yiwiy', '9Yiwiy'), ('yiwiy9', 'yiwiY9')] p = 0 while p < len(t): for a, b in xs: if t.startswith(a, p): res.append(b) p += len(a) break else: res.append(t[p]) p += 1 return ''.join(res) H, W = map(int, input().split()) for s in [input() for _ in range(H)]: print(replace(s))