#![allow(unused_imports)] use std::{*, collections::*, ops::*, cmp::*, iter::*}; use proconio::{input, fastout}; fn main() { solve(); } type us = usize; // CONTEST(abcXXX-a) #[fastout] fn solve() { input! {h:us,w:us,mut s:[proconio::marker::Chars;h]} let r = "yiwiy9".chars().collect::>(); let l = "9yiwiy".chars().collect::>(); for i in 0..h { let mut j = 0; while j < w { let t = s[i][j..].iter().take(6).cloned().collect::>(); if t == r { s[i][j+4] = 'Y'; j += 6; } else if t == l { s[i][j+1] = 'Y'; j += 6; } else { j += 1; } } } for i in 0..h { println!("{}", s[i].iter().collect::()); } } // #CAP(fumin::modint) pub mod fumin { }