#include #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 #define int long long using namespace std; typedef long long ll; typedef vector> mat; const int INF = 1e9; int R, K; int H, W; char c[10][10]; char c2[10][10]; signed main() { cin >> R >> K; cin >> H >> W; REP(i,H) REP(j,W) cin >> c[i][j]; if (R == 0 || R == 180) { REP(i,H) REP(j,W) { c2[i][j] = c[i][j]; } } else if (R == 90 || R == 270) { REP(i,H) REP(j,W) { c2[j][H-1-i] = c[i][j]; } swap(H, W); } /* } else if (R == 180) { REP(i,H) REP(j,W) { c2[H-1-i][W-1-j] = c[i][j]; } */ /* } else if (R == 270) { REP(i,H) REP(j,W) { c2[W-1-j][i] = c[i][j]; } swap(H, W); } */ REP(i,H) { REP(j,K) { REP(k,W) { REP(l,K) { cout << c2[i][k]; } } cout << endl; } } }