#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int r, k, h, w; cin >> r >> k >> h >> w; vector a(h, vector(w)); rep(i, h) rep(j, w) cin >> a[i][j]; rep(_, r / 90) { vector b(w, vector(h)); rep(i, h) rep(j, w) b[j][h - 1 - i] = a[i][j]; swap(a, b); swap(h, w); } rep(i, h) rep(_, k) { rep(j, w) rep(__, k) cout << a[i][j]; cout << '\n'; } return 0; }