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

stage = [list(input()) for i in range(h)]

ans = [0 for i in range(2*h)]

for i in range(h):

    ans[2*i] = stage[i]

    ans[2*i+1] = stage[i]

for i in ans:

    for j in i:

        print(j, end = "")

    print()

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

C = []

for i in range(H):

    C.append(eval(input()))



for i in range(H):

    print((C[i]))

    print((C[i]))
h, w = map(int, input().split())
stage = [list(input()) for i in range(h)]
ans = [0 for i in range(2 * h)]
for i in range(h):
    ans[2 * i] = stage[i]
    ans[2 * i + 1] = stage[i]
for i in ans:
    for j in i:
        print(j, end="")
    print()

H, W = list(map(int, input().split()))
C = []
for i in range(H):
    C.append(eval(input()))
for i in range(H):
    print((C[i]))
    print((C[i]))

-h, w = map(int, input().split()) -stage = [list(input()) for i in range(h)] -ans = [0 for i in range(2 * h)] -for i in range(h): -    ans[2 * i] = stage[i] -    ans[2 * i + 1] = stage[i] -for i in ans: -    for j in i: -        print(j, end="") -    print() +H, W = list(map(int, input().split())) +C = [] +for i in range(H): +    C.append(eval(input())) +for i in range(H): +    print((C[i])) +    print((C[i]))