N,K=map(int,input().split()) A=[list(input()) for _ in range(N)] for a in A: tmp="" for c in a: tmp+=c*K for _ in range(K): print(tmp)