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



for i in range(H):

    x = eval(input())

    print(x)

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



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



for i in range(H):

    print((C[i]))

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

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

+C = [eval(input()) for i in range(H)] -    x = eval(input()) -    print(x) -    print(x) +    print((C[i])) +    print((C[i]))