#!/usr/bin/env python3



H,W = map(int,input().split())

C = [list(input()) if i%2 == 0 else [0 for j in range(W)] for i in range(2*H)]

#print(C)

for i in range(2*H):

    if i % 2 == 1:

        for j in range(W):

            C[i][j] = C[i-1][j]

#print(C)

for i in range(2*H):

    for j in range(W):

        if j != W-1:

            print(C[i][j],end='')

        else:

            print(C[i][j])

#!/usr/bin/env python3



h,w = list(map(int,input().split()))

c = [list(eval(input())) if i % 2 == 0 else [] for i in range(2*h)]



for i in range(h):

    c[2*i+1] = c[2*i]

for i in range(2*h):

    print((''.join(c[i])))

#!/usr/bin/env python3
H, W = map(int, input().split())
C = [list(input()) if i % 2 == 0 else [0 for j in range(W)] for i in range(2 * H)]
# print(C)
for i in range(2 * H):
    if i % 2 == 1:
        for j in range(W):
            C[i][j] = C[i - 1][j]
# print(C)
for i in range(2 * H):
    for j in range(W):
        if j != W - 1:
            print(C[i][j], end="")
        else:
            print(C[i][j])

#!/usr/bin/env python3
h, w = list(map(int, input().split()))
c = [list(eval(input())) if i % 2 == 0 else [] for i in range(2 * h)]
for i in range(h):
    c[2 * i + 1] = c[2 * i]
for i in range(2 * h):
    print(("".join(c[i])))

-H, W = map(int, input().split()) -C = [list(input()) if i % 2 == 0 else [0 for j in range(W)] for i in range(2 * H)] -# print(C) -for i in range(2 * H): -    if i % 2 == 1: -        for j in range(W): -            C[i][j] = C[i - 1][j] -# print(C) -for i in range(2 * H): -    for j in range(W): -        if j != W - 1: -            print(C[i][j], end="") -        else: -            print(C[i][j]) +h, w = list(map(int, input().split())) +c = [list(eval(input())) if i % 2 == 0 else [] for i in range(2 * h)] +for i in range(h): +    c[2 * i + 1] = c[2 * i] +for i in range(2 * h): +    print(("".join(c[i])))