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

original = [list(eval(input())) for i in range(H)]

converted = [[0 for j in range(W)] for i in range(2 * H)]

for i in range(2 * H):

    for j in range(W):

        converted[i][j] = original[i // 2][j]

        

for row in converted:

    print((''.join(row)))
H, W = list(map(int, input().split()))

original = [list(eval(input())) for i in range(H)]

for i in range(2 * H):

    print((''.join(original[i // 2][:])))
H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
converted = [[0 for j in range(W)] for i in range(2 * H)]
for i in range(2 * H):
    for j in range(W):
        converted[i][j] = original[i // 2][j]
for row in converted:
    print(("".join(row)))

H, W = list(map(int, input().split()))
original = [list(eval(input())) for i in range(H)]
for i in range(2 * H):
    print(("".join(original[i // 2][:])))

-converted = [[0 for j in range(W)] for i in range(2 * H)] -    for j in range(W): -        converted[i][j] = original[i // 2][j] -for row in converted: -    print(("".join(row))) +    print(("".join(original[i // 2][:])))