N,K = map(int,input().split()) A = [input() for _ in range(N)] for i in range(N * K): for j in range(N * K): print(A[i//K][j//K],end = "") print()