def main():

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

    c = list(list(input()) for i in range(h))



    for i in range(2*h):

        for j in range(w):

            print(c[int(i/2)][j], end='')

        print()



main()

def main():

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



    for i in range(h):

        s = eval(input())

        print((s + '\n' + s + '\n'))



main()

def main():
    h, w = map(int, input().split())
    c = list(list(input()) for i in range(h))
    for i in range(2 * h):
        for j in range(w):
            print(c[int(i / 2)][j], end="")
        print()


main()

def main():
    h, w = list(map(int, input().split()))
    for i in range(h):
        s = eval(input())
        print((s + "\n" + s + "\n"))


main()

-    h, w = map(int, input().split()) -    c = list(list(input()) for i in range(h)) -    for i in range(2 * h): -        for j in range(w): -            print(c[int(i / 2)][j], end="") -        print() +    h, w = list(map(int, input().split())) +    for i in range(h): +        s = eval(input()) +        print((s + "\n" + s + "\n"))