n,k = map(int,input().split()) for i in range(n): ls = list(input()) w = "" for j in ls: w += j*k for j in range(k): print(w)