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