#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; vector rotate( vector s ) { vector ret; for ( int x = 0; x < s[0].size(); x++ ) { string t = ""; for ( int y = s.size()-1; y >= 0; y-- ) { t += s[y][x]; } ret.push_back(t); } return ret; } int main() { int R,K,H,W; cin >> R >> K >> H >> W; vector S(H); for ( int i = 0; i < H; i++ ) { cin >> S[i]; } vector r; r = S; for ( int i = 0; i < R/90; i++ ) { r = rotate(r); } // for ( int y = 0; y < r.size(); y++ ) { // cout << r[y] << endl; // } for ( int y = 0; y < r.size()*K; y++ ) { string t = ""; for ( int x = 0; x < r[0].size()*K; x++ ) { t += r[y/K][x/K]; } cout << t << endl; } return 0; }