#include #include #include #include template std::vector vec(int len, T elem) { return std::vector(len, elem); } void solve() { int r, k, h, w; std::cin >> r >> k >> h >> w; auto ss = vec(h, vec(w, '*')); for (auto& s : ss) { for (auto& c : s) std::cin >> c; } r /= 90; while (r--) { auto nss = vec(w, vec(h, '*')); for (int x = 0; x < h; ++x) { for (int y = 0; y < w; ++y) { nss[y][x] = ss[x][y]; } } std::swap(ss, nss); for (auto& s : ss) std::reverse(s.begin(), s.end()); std::swap(h, w); } for (int x = 0; x < h * k; ++x) { for (int y = 0; y < w * k; ++y) { std::cout << ss[x / k][y / k]; } std::cout << std::endl; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }