#include static inline constexpr std::vector solve(const uint_fast32_t H, const uint_fast32_t W, std::vector& S) noexcept { std::vector ans(H); for (uint_fast32_t i = 0; i != H; ++i) { ans[i].resize(W, '.'); while (1) { const auto pos_l = S[i].find("9yiwiy"); const auto pos_r = S[i].find("yiwiy9"); if (std::min(pos_l, pos_r) == S[i].npos) break; else if (pos_l < pos_r) ans[i].replace(pos_l, 6, "9Yiwiy"), S[i].replace(pos_l, 6, "......"); else ans[i].replace(pos_r, 6, "yiwiY9"), S[i].replace(pos_r, 6, "......"); } } return ans; } static inline void output(const uint_fast32_t H, const uint_fast32_t W, const std::vector& ans) noexcept { for (uint_fast32_t i = 0; i != H; ++i) std::cout << ans[i] << '\n'; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t H, W, i; std::cin >> H >> W; std::vector S(H); for (i = 0; i != H; ++i) S[i].reserve(W), std::cin >> S[i]; output(H, W, solve(H, W, S)); return 0; }