n,k=map(int,input().split()) lst=[input() for _ in range(n)] gansl=[["."]*(k*n) for _ in range(n*k)] # for i in range(n*k): # print(*gansl[i]) for i in range(n*k): for j in range(n*k): gansl[i][j]=lst[i//k][j//k] for i in range(n*k): print(*gansl[i],sep="")