#include<bits/stdc++.h>
using namespace std;
int s[300][300];
int main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
getchar();
for(int i=1;i<=a;i++)
{
for(int j=1;j<=b;j++) scanf("%c",&s[i][j]);
getchar();
}
for(int i=1;i<=a;i++) for(int ii=1;ii<=c;ii++)
{
for(int j=1;j<=b;j++) for(int jj=1;jj<=d;jj++) printf("%c",s[i][j]);
if((i==a&&ii!=c)||i!=a) printf("\n");
}
return 0;
}