def main():

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



    px = [[0 for j in range(w)] for i in range(h)]

    px_stretch = [[0 for j in range(w)] for i in range(2 * h)]



    for row in range(h):

        px[row] = list(eval(input()))



    for row in range(2 * h):

        px_stretch[row] = [px[row // 2][i] for i in range(w)]

        print((''.join(px_stretch[row])))





if __name__ == "__main__":



    main()

def main():

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

    px = [input() for i in range(h)]



    for row in range(h):

        print(px[row], px[row], sep='\n')



    # px = [[0 for j in range(w)] for i in range(h)]

    # px_stretch = [[0 for j in range(w)] for i in range(2 * h)]

    # 

    # for row in range(h):

    #     px[row] = list(input())

    # 

    # for row in range(2 * h):

    #     px_stretch[row] = [px[row // 2][i] for i in range(w)]

    #     print(''.join(px_stretch[row]))





if __name__ == "__main__":



    main()

def main():
    h, w = list(map(int, input().split()))
    px = [[0 for j in range(w)] for i in range(h)]
    px_stretch = [[0 for j in range(w)] for i in range(2 * h)]
    for row in range(h):
        px[row] = list(eval(input()))
    for row in range(2 * h):
        px_stretch[row] = [px[row // 2][i] for i in range(w)]
        print(("".join(px_stretch[row])))


if __name__ == "__main__":
    main()

def main():
    h, w = map(int, input().split())
    px = [input() for i in range(h)]
    for row in range(h):
        print(px[row], px[row], sep="\n")
    # px = [[0 for j in range(w)] for i in range(h)]
    # px_stretch = [[0 for j in range(w)] for i in range(2 * h)]
    #
    # for row in range(h):
    #     px[row] = list(input())
    #
    # for row in range(2 * h):
    #     px_stretch[row] = [px[row // 2][i] for i in range(w)]
    #     print(''.join(px_stretch[row]))


if __name__ == "__main__":
    main()

-    h, w = list(map(int, input().split())) -    px = [[0 for j in range(w)] for i in range(h)] -    px_stretch = [[0 for j in range(w)] for i in range(2 * h)] +    h, w = map(int, input().split()) +    px = [input() for i in range(h)] -        px[row] = list(eval(input())) -    for row in range(2 * h): -        px_stretch[row] = [px[row // 2][i] for i in range(w)] -        print(("".join(px_stretch[row]))) +        print(px[row], px[row], sep="\n") +    # px = [[0 for j in range(w)] for i in range(h)] +    # px_stretch = [[0 for j in range(w)] for i in range(2 * h)] +    # +    # for row in range(h): +    #     px[row] = list(input()) +    # +    # for row in range(2 * h): +    #     px_stretch[row] = [px[row // 2][i] for i in range(w)] +    #     print(''.join(px_stretch[row]))