# coding: utf-8

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



for _ in range(H):

    l = eval(input())

    print((l + "\n" + l))
# coding: utf-8

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



for _ in range(H):

    l = input()

    print(l, l, sep="\n")

# coding: utf-8
H, W = list(map(int, input().split()))
for _ in range(H):
    l = eval(input())
    print((l + "\n" + l))

# coding: utf-8
H, W = map(int, input().split())
for _ in range(H):
    l = input()
    print(l, l, sep="\n")

-H, W = list(map(int, input().split())) +H, W = map(int, input().split()) -    l = eval(input()) -    print((l + "\n" + l)) +    l = input() +    print(l, l, sep="\n")