height, width = map(int, input().split()) input_list = [] for i in range(height): input_list.append(input()) for row in input_list: pos_w = row.find('w') pos_9 = row.find('9') buf = list(row) if pos_9 < pos_w: buf[pos_9+1] = 'Y' else: buf[pos_9-1] = 'Y' print("".join(buf))