N,K = map(int, input().split(' ')) lst = [] for i in range(N): lst.append(input()) for i in lst: for j in range(K): print(''.join([l*K for l in i]))