H, W = gets.split.map(&:to_i) ans = Array.new(H) { "" } H.times do |i| str = gets.chomp j = 0 while j < W case str[j] when "y" ans[i] << "yiwiY9" j += 6 when "9" ans[i] << "9Yiwiy" j += 6 else ans[i] << str[j] j += 1 end end end puts ans