N, K = map(int, input().split()) F = [input() for _ in range(N)] tmp = '' FN = [] for x in F: tmp = '' for s in x: tmp += s*K for k in range(K): FN.append(tmp) for x in FN: print(*x)