N,K = map(int,input().split()) A = [input() for i in range(N)] for row in A: out = '' for c in row: out += c*K for _ in range(K): print(out)