# frozen_string_literal: true in_h, in_w = gets.chomp.split.map(&:to_i) in_s = in_h.times.map { gets }.join.chomp puts in_s.gsub("9yiwiy", "9Yiwiy").gsub("yiwiy9", "yiwiY9")