Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line, that is, the right part of the image moves to the left, and vice versa) and zooming on the image. He is sure that that there is a large number of transformations that can be expressed through these three.

He has recently stopped implementing all three transformations for monochrome images. To test this feature, he asked you to write a code that will consecutively perform three actions with a monochrome image: first it will rotate the image 90 degrees clockwise, then it will flip the image horizontally and finally, it will zoom in twice on the image (that is, it will double all the linear sizes).

Implement this feature to help Polycarp test his editor.


-----Input-----

The first line contains two integers, w and h (1 ≤ w, h ≤ 100) — the width and height of an image in pixels. The picture is given in h lines, each line contains w characters — each character encodes the color of the corresponding pixel of the image. The line consists only of characters "." and "*", as the image is monochrome.


-----Output-----

Print 2w lines, each containing 2h characters — the result of consecutive implementing of the three transformations, described above.


-----Examples-----
Input
3 2
.*.
.*.

Output
....
....
****
****
....
....

Input
9 20
**.......
****.....
******...
*******..
..******.
....****.
......***
*.....***
*********
*********
*********
*********
....**...
...****..
..******.
.********
****..***
***...***
**.....**
*.......*

Output
********......**********........********
********......**********........********
********........********......********..
********........********......********..
..********......********....********....
..********......********....********....
..********......********..********......
..********......********..********......
....********....****************........
....********....****************........
....********....****************........
....********....****************........
......******************..**********....
......******************..**********....
........****************....**********..
........****************....**********..
............************......**********
............************......**********

Difficulty: interview

Starter code:

Solutions:
w, h = map(int, input().split())		
image = [input() for i in range(h)]
for i in range(w):
    image2 = ""
    for j in range(h):
        temp = image[j][i]
        print(temp+temp,end="")
        image2 += temp + temp
    print()
    print(image2)


def main():
    w, h = list(map(int, input().split()))
    a = [input() for i in range(h)]
    for i in range(w):
        b = [a[j][i]*2 for j in range(h)]
        s = ''.join(b)
        print(s)
        print(s)
def __starting_point():
    main()

__starting_point()

n = input().split()
old = []
new = []
for i in range(int(n[1])):
	old.append(list(input()))
for i in range(int(n[0])):
	new.append([])
	for j in range(int(n[1])):
		new[-1].append(old[j][i])
		new[-1].append(old[j][i])
	new.append(new[-1])
for i in new:
	print(''.join(i))

w, h = map(int, input().split())
file = [[] for i in range(w)]

for i in range(h):
    l  = list(input())
    for j in range(w):
        file[j].append(l[j])

for i in range(w):
    print(''.join([c*2 for c in file[i]]))
    print(''.join([c*2 for c in file[i]]))

w, h = [int(i) for i in input().split()]
a = []
for i in range(h):
    a.append([])
    a[i] = [q for q in input().strip()]
for i in range(w):
    now_str = ''
    for q in range(h):
        now_str += a[q][i] * 2
    print(now_str)
    print(now_str)

def mash(pole):
    ans = []
    for i in range(len(pole)):
        s = pole[i]
        new = ''
        for i in s:
            new += (i * 2)
        ans.append(new)
        ans.append(new)
    return ans

def change(pole, a, b):
    x = len(pole[0]) % 2
    fir = []
    sec = []
    new = []
    for i in range(b):
        s = ''
        for j in range(a):
            s += pole[j][i]
        if i + 1 <= len(pole[0]) // 2:
            fir.append(s)
            continue
        if i + 1 >= (len(pole[0]) // 2 + x):
            sec.append(s)
    for i in range(len(sec[0])):
        s = ''
        for j in range(len(sec) + len(fir)):
            if j < len(sec):
                s += sec[j][i]
            else:
                s += fir[j - len(sec)][i]
        new.append(s)
    return new
def pov(pole, a, b):
    new = []
    for i in range(a):
        s = ''
        for j in range(b):
            s += pole[j][i]
        new.append(s)
    return new
        
a, b = list(map(int, input().split()))
pole = []
for i in range(b):
    s = input()
    pole.append(s)
new = mash(pov(pole, a, b))
for i in new:
    print(i)


inp = str(input()).split(' ')
w, h = int(inp[0]), int(inp[1])
image = []
for x in range(h):
    row = str(input())
    image.append([x for x in row])


def turn90():
    turned = []
    for x in range(w):
        row = []
        for y in range(h):
            row.append(image[y][x])
        turned.append(row)
    return turned

image = turn90()

def mirror():
    mirroed = []
    for row in image:
        row.reverse()
        mirroed.append(row)
    return mirroed

def multiply():
    multi = []
    for row in image:
        multi.append(''.join([y * 2 for y in row]))
        multi.append(''.join([y * 2 for y in row]))
    for row in multi:
        print(''.join(row))

multiply()

n,m = list(map(int,input().split(' ')))
a = [ '' for i in range(m)]
for i in range(m) :
          a[i] = input()

def printImage(table) :
          for s in table :
                    ans = ''
                    for c in s :
                              ans+=c*2
                    print(ans)
                    print(ans)

b = []
for i in range(n) :
          ans = ''
          for s in a : ans+=s[i]
          b.append(ans)

printImage(b)
                    
                    
          
          



w, h = list(map(int, input().split()))
first_matr = list()
second_matr = [' '] * w
for i in range(w):
    second_matr[i] = [' '] * h

third_matr = [' '] * 2 * w
for i in range(2 * w):
    third_matr[i] = [' '] * 2 * h

for i in range(h):
    s = input()
    first_matr.append([])
    for j in s:
        first_matr[i].append(j)

for i in range(w):
    for j in range(h):
        second_matr[i][j] = first_matr[j][i]

for i in range(w):
    for j in range(h):
        third_matr[2*i][2*j] = third_matr[2*i+1][2*j] = third_matr[2*i][2*j+1] = third_matr[2*i+1][2*j+1] = second_matr[i][j]

for k in third_matr:
    for j in k:
        print(j, end="")
    print()


w, h = map(int, input().split())
listGorizontal = []
listVertical = []
for i in range(h):
    listGorizontal.append(input())
for i in range(h):
    s = ""
    k = w
    for j in listGorizontal[i]:
        s += j[w - k]*2
    listVertical.append(s)
s = ""
k = h
for i in range(2*w):
    for j in range(h):
        s += 2 * listVertical[h - k][i]
        k += -1
    k = h
    if i != 2*w :
        s += "\n"
print(s)

__author__ = 'ruckus'

x, y = map(int, input().split())

a = []

for i in range(y):
    a.append(input())

for i in range(x):
        for k in range(2):
            for j in range(y):
                print(a[j][i], end='')
                print(a[j][i], end='')
            print()

w,h = map(int,input().split())
a = []
for i in range(h):
    a.append(list(input()))
b = []
for i in range(w):
    b.append([a[j][i] for j in range(h)])
for i in range(w):
    b[i] == b[i][::-1]
out = ''
for i in range(w):
    t = ''
    for j in range(h):
        t += b[i][j] + b[i][j]
    out += t + '\n' + t + '\n'
print(out[:-1])

w, h = [int(x) for x in input().split(' ')]
img = []
for i in range(h):
    img.append([c for c in input()])

for j in (range(w)):
    row = []
    for i in (range(h)):
        row.append(img[i][j])
        row.append(img[i][j])
    print(*row, sep='', end='\n')
    print(*row, sep='',end='\n')

a, b = [int(i) for i in input().split()]


matrix_in = [[0 for i in range(a)] for j in range(b)]
for i in range(b):
    line = input()
    for j in range(a):
        matrix_in[i][j] = line[j]

# Right rotate and flip
matrix_rotated = [[0 for i in range(b)] for j in range(a)]
for i in range(a):
    for j in range(b):
        matrix_rotated[i][j] = matrix_in[j][i]

# Print
for i in range(a):
    toprint=""
    for j in range(b): 
        toprint += matrix_rotated[i][j]*2
    print(toprint)
    print(toprint)


def rotate(p, w, h):
    rot = [[] for i in range(w)]
    for i in range(w):
        for j in range(h):
            rot[i].append(p[j][i])
        rot[i] = list(reversed(rot[i]))
    return rot

def double():
    nonlocal mas, r
    p = 0
    for i in range(h):
        s = ''
        for j in r[i]:
            s += j * 2
        mas[p] = s
        mas[p + 1] = s
        p += 2   

def reverse():
    nonlocal r
    for i in range(h):
        r[i] = list(reversed(r[i]))    

w, h = map(int, input().split())
p = [[] for i in range(h)]
for i in range(h):
    s = input()
    for j in range(w):
        p[i].append(s[j])
r = rotate(p, w, h)
h, w = w, h
reverse()
mas = [['.' for i in range(w * 2)] for i in range(h * 2)]
double()
for i in range(h * 2):
    print(*mas[i], sep='')


n, m = [int(x) for x in input().split()]
arr = []
turn = []
for i in range(n):
    turn.append([None] * m)

for i in range(m):
    arr.append(list(input()))
    
for i in range(m):
    for j in range(n):
        turn[j][i] = arr[i][n - j - 1]

s = []
for i in range(n):
    s.append(list(turn[i]))
#------------------------------------------


for i in range(m):
    for j in range(n):
        turn[j][i] = s[n - j - 1][i]


for i in range(n):
    for k in range(2):
        for j in range(m):
            print(turn[i][j] * 2, end="")
        print()
            

    


w, h = [int(i) for i in input().split()]
bitmap = [list(input()) for i in range(h)]

bitmap = [[bitmap[i // 2][j // 2] for i in range(2 * h)] for j in range(2 * w)]

print('\n'.join(''.join(i) for i in bitmap))


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

s = []
for i in range(h):
    s.append(input())

a = []
for i in range(w):
    a.append([0] * h)

for i in range(h):
    for j in range(w):
        a[j][i] = s[i][j]

for i in range(w):
    st = ''
    for c in a[i]:
        st += c * 2
    print(st)
    print(st)

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

a = []
for i in range(h):
    a.append(input())

for i in range(w):
    line = ''
    for j in range(h):
        line += a[j][i] * 2
    print(line, line, sep='\n')

m,n = list(map(int,input().split()))
a = [ [0]*m for i in range(n)]
for i in range(n):
    h = input()
    for j in range(m):
        a[i][j]=h[j]
s = list(zip(*a))
b = [ [0]*2*n for i in range(2*m)]
for i in range(2*m):
    for j in range(2*n):
        b[i][j]=s[i//2][j//2]
for i in b:
    print(''.join(map(str,i)))


w, h = map(int, input().split())
a = []
res = [[0] * h for i in range(w)]
for i in range(h):
    s = input()
    for i2 in range(w):
        res[i2][h - i - 1] = s[i2]
for i in range(w):
    res[i] = res[i][::-1]
for elem in res:
    for i in range(2):
        for i2 in range(h):
            print(elem[i2], end='')
            print(elem[i2], end='')
        print()

m=0
l=input()
a=''
b=''
while l[m]!= " ":
            a=a+str(l[m])
            m+=1
a=int(a)
while m!=len(l):
            b=b+str(l[m])
            m+=1
            
b=int(b)
h=0
kartina=[]
for lo in range(b):
    o=list(input())
    kartina.append(o)
for k in range (a):
    for t in range (b):
        
        print(kartina[t][k],end="")
        print(kartina[t][k],end="")
    print()    
    for t in range (b):
        print(kartina[t][k],end="")
        print(kartina[t][k],end="")
    print()    


ar1 = []
n, m = map(int, input().split())
ar = []
for i in range(m):
    s1 = []
    s = input().rstrip()
    for j in range(n):
        s1.append(s[j])
    ar.append(s1)
ark = []
for i in range(m):
    ark.append(ar[m - i - 1])
ar = ark[:]
for i in range(n):
    s = []
    for j in range(m - 1, -1 , -1):
        s.append(ar[j][i])
    ar1.append(s)
for i in range(n):
    for j in ar1[i]:
        print(j*2, end = '')

    print()
    for j in ar1[i]:
        print(j*2, end = '')   
    print()
    

w,h=(int(x) for x in input().split(' '))
massive=[]
for i in range(h):
    mass=[]
    for elem in input(): 
        mass.append(elem)
        mass.append(elem)
    massive.append(mass)
    massive.append(mass)


    
for i in range(2*w):
    for j in range(2*h):
        print(massive[j][i],end='')
    print()
        


w, h = map( int, input( ).split( ) )
stgs = [ ]

for i in range( h ):
    stgs.append( input( )  )

m = [0] * h
for i in range(h):
    m[i] = [0] * w

for i in range( h ):
    for j in range( w ):
        m[ i ][ j ] = stgs[ i ][ j ]

for i in range( h ):
    m[ i ].reverse( )

sk = 1
st = ""

for i in range( w - 1, -1, -1 ):
    for j in range( h ):
        st += m[ j ][ i ] + m[ j ][ i ]
    print( st, st, sep = '\n' )
    st = ''