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