n,k = map(int, input().split()) S = [list(input()) for _ in range(n)] for i in range(n): for m in range(k): for j in range(n): for l in range(k): print(S[i][j],end='') print("") #print("")