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
********......**********........********
********......**********........********
********........********......********..
********........********......********..
..********......********....********....
..********......********....********....
..********......********..********......
..********......********..********......
....********....****************........
....********....****************........
....********....****************........
....********....****************........
......******************..**********....
......******************..**********....
........****************....**********..
........****************....**********..
............************......**********
............************......**********

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
(w, h) = list(map(int, input().split()))
a = []
for i in range(h):
	a.append(input())
for i in range(w):
	s = ''
	for j in range(h):
		s += a[j][i] * 2
	print(s, s, sep='\n')


(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) = (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()


from sys import stdin, stdout

def pcol2(s, i):
	write = stdout.write
	for j in range(len(s)):
		write(s[j][i] * 2)
	write('\n')
next(stdin)
s = stdin.read().split()
for i in range(len(s[0])):
	pcol2(s, i)
	pcol2(s, i)


(w, h) = map(int, input().split())
(q, r) = ([input() for i in range(h)], [''] * w)
for i in range(w):
	for j in range(h):
		r[i] += str(q[j][i]) * 2
for i in r:
	print(i)
	print(i)


(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)


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()


(n, m) = list(map(int, input().split()))
data = [list(input()) for i in range(m)]
data_transp = [[''] * m for i in range(n)]
for i in range(n):
	for j in range(m):
		data_transp[i][j] = data[m - j - 1][i]
data_mirror = [[''] * m for i in range(n)]
for i in range(n):
	for j in range(m):
		data_mirror[i][j] = data_transp[i][m - j - 1]
data_large = [[''] * (m * 2) for i in range(n * 2)]
for i in range(n):
	for j in range(m):
		data_large[i * 2][j * 2] = data_mirror[i][j]
		data_large[i * 2 + 1][j * 2] = data_mirror[i][j]
		data_large[i * 2][j * 2 + 1] = data_mirror[i][j]
		data_large[i * 2 + 1][j * 2 + 1] = data_mirror[i][j]
for i in range(2 * n):
	data_large[i] = ''.join(data_large[i])
print('\n'.join(data_large))


import sys
(w, h) = (int(x) for x in input().split())
pic = [[''] * 2 * h for _ in range(2 * w)]
for (i, row) in enumerate(sys.stdin):
	if not row.strip() or i >= h:
		break
	for (j, c) in enumerate(row[:-1]):
		if j >= w:
			continue
		pic[2 * j][2 * i] = c
		pic[2 * j][2 * i + 1] = c
		pic[2 * j + 1][2 * i] = c
		pic[2 * j + 1][2 * i + 1] = c
	if i == h - 1:
		break
print('\n'.join((''.join(row) for row in pic)))


(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]
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]
for i in range(a):
	toprint = ''
	for j in range(b):
		toprint += matrix_rotated[i][j] * 2
	print(toprint)
	print(toprint)


(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()


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()


(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)


I = input
R = range
(w, h) = map(int, I().split())
t = [I() for _ in R(h)]
for r in [[t[i][j] * 2 for i in R(h)] for j in R(w)]:
	s = ''.join(r)
	print(s + '\n' + s)


class CodeforcesTask523ASolution:

	def __init__(self):
		self.result = ''
		self.w_h = []
		self.image = []

	def read_input(self):
		self.w_h = [int(x) for x in input().split(' ')]
		for x in range(self.w_h[1]):
			self.image.append(list(input()))

	def process_task(self):
		rotated = [['_' for x in range(self.w_h[1])] for y in range(self.w_h[0])]
		for x in range(self.w_h[1]):
			for y in range(self.w_h[0]):
				rotated[y][x] = self.image[x][y]
		zoomed = [[c + c for c in row] for row in rotated]
		for row in zoomed:
			print(''.join(row))
			print(''.join(row))

	def get_result(self):
		return self.result
Solution = CodeforcesTask523ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(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) = map(int, input().split())
z = [None] * h
for i in range(h):
	z[i] = input()
for i in range(w):
	for j in range(2):
		for k in range(h):
			print(z[k][i] + z[k][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 = ''


def function():
	size = input().split(' ')
	w = int(size[0])
	h = int(size[1])
	if not 1 <= w <= 100 and (not 1 <= h <= 100):
		return None
	matrix_result = [[None for j in range(0, 2 * h)] for i in range(0, 2 * w)]
	for i in range(0, h):
		arr = list(input())
		for j in range(0, w):
			matrix_result[2 * j][2 * i] = arr[j]
			matrix_result[2 * j + 1][2 * i] = arr[j]
			matrix_result[2 * j][2 * i + 1] = arr[j]
			matrix_result[2 * j + 1][2 * i + 1] = arr[j]
	for i in range(0, 2 * w):
		print(''.join((str(x) for x in matrix_result[i])))
function()


(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)))


from sys import *
input = stdin.readline
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())
sJoin = lambda a, sep: f'{sep}'.join(a)
arrJoin = lambda a, sep: f'{sep}'.join(map(str, a))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def main():
	(w, h) = lineInput()
	arr = [list(input().strip()) for i in range(h)]
	for i in range(w):
		s = ''
		for j in range(h):
			s += arr[j][i] * 2
		else:
			print(s)
			print(s)
main()


(w, h) = map(int, input().split())
arr = [list(input()) for i in range(h)]
rotated_and_mirrored = [[arr[i][j] for i in range(h)] for j in range(w)]
ans = [['' for i in range(2 * h)] for j in range(2 * w)]
for i in range(w):
	for j in range(h):
		for dx in range(2):
			for dy in range(2):
				ans[2 * i + dx][2 * j + dy] = rotated_and_mirrored[i][j]
print('\n'.join(map(lambda x: ''.join(x), ans)))


__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()


(n, m) = map(int, input().split())
a = []
for i in range(m):
	s = input()
	a.append(s)
a.reverse()
b = []
for i in range(n):
	s = ''
	for j in range(m):
		s += a[j][i]
	b.append(s)
for i in b:
	val = i[::-1]
	for j in val:
		print(j * 2, end='')
	print()
	for j in val:
		print(j * 2, end='')
	print()


(w, h) = map(int, input().split())
l = []
for i in range(h):
	s = input()
	l.append(s)
for i in range(w):
	s = ''
	for j in range(h - 1, -1, -1):
		s += l[j][i] * 2
	s = s[::-1]
	print(s)
	print(s)


(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)


import sys

def main():
	(w, h) = [int(i) for i in input().split()]
	p = []
	for i in range(h):
		s = input()
		p.append(s)
	p = zip(*p)
	for s in p:
		result = ''
		for ch in s:
			result += ch + ch
		print(result)
		print(result)
main()


(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) = map(int, input().split())
l = [[] for _ in range(w)]
for _ in range(h):
	ip = input()
	for i in range(w):
		l[i].append(ip[i])
ans = []
for i in range(w):
	target = l[i]
	etc = []
	for j in target:
		etc.append(j * 2)
	ans.append(etc)
	ans.append(etc)
for i in ans:
	print(*i, sep='')


s = input()
w = int(s.split()[0])
h = int(s.split()[1])
L = []
L2 = []
s2 = ''
for i in range(h):
	L.append(input())
for i in range(w):
	for k in range(h - 1, -1, -1):
		s2 = s2 + L[k][i]
	L2.append(s2)
	s2 = ''
L3 = []
s3 = ''
for i in range(w):
	for k in range(h - 1, -1, -1):
		s3 = s3 + L2[i][k]
	L3.append(s3)
	s3 = ''
L4 = []
for i in range(w):
	for k in range(h):
		s3 = s3 + L3[i][k] * 2
	L4.append(s3)
	L4.append(s3)
	s3 = ''
w2 = w * 2
for i in range(w2):
	print(L4[i])


(w, h) = map(int, input().split())
a = []
for i in range(h):
	a.append(list(input()))
b = [[0 for j in range(h)] for i in range(w)]
for i in range(h):
	for j in range(w):
		b[j][i] = a[i][j]
for i in range(w):
	x = ''
	for j in range(h):
		x = x + b[i][j] + b[i][j]
	print(x)
	print(x)


(w, h) = map(lambda s: int(s), input().split())
img = []
tmp = []
cols = []
for i in range(0, h):
	img.append(list(input()))
for i in range(0, w):
	line = str()
	for j in range(0, h):
		val = img[j][i]
		line = line + val + val
	print(line)
	print(line)


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()


(w, h) = map(int, input().split())
a = [input().strip() for _ in range(h)]
a = list(zip(*a[::-1]))
a = a[::-1]
a = list(zip(*a[::-1]))
a = list(zip(*a[::-1]))
for i in a:
	for _ in range(2):
		for j in i:
			print(j * 2, end='')
		print()


(m, n) = map(int, input().split(' '))
lis = []
for x in range(n):
	str1 = input()
	lis.append(str1)
for x in range(2 * m):
	for y in range(2 * n):
		print(lis[y // 2][x // 2], end='')
	print('')


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():
	global 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():
	global 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='')


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) = map(int, input().split())
arr = [[] for i in range(h)]
for i in range(h):
	for j in input():
		arr[i].append(j)
arr2 = [['' for j in range(h)] for i in range(w)]
for i in range(h):
	for j in range(w):
		arr2[j][h - 1 - i] = arr[i][j]
for i in range(h // 2):
	for j in range(w):
		(arr2[j][i], arr2[j][h - i - 1]) = (arr2[j][h - i - 1], arr2[j][i])
arr3 = [['' for j in range(2 * h)] for i in range(2 * w)]
for i in range(2 * w):
	for j in range(2 * h):
		arr3[i][j] = arr2[i // 2][j // 2]
for i in range(2 * w):
	for j in range(2 * h):
		print(arr3[i][j], end='')
	print()


(n, m) = 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) = 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)


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) = 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)


(w, h) = map(int, input().split())
a = []
for i in range(h):
	a.append(input())
b = [[None] * (2 * h) for _ in range(2 * w)]
for i in range(w):
	for j in range(h):
		b[2 * i][2 * j] = a[j][i]
		b[2 * i][2 * j + 1] = a[j][i]
		b[2 * i + 1][2 * j] = a[j][i]
		b[2 * i + 1][2 * j + 1] = a[j][i]
print('\n'.join([''.join(i) for i in b]))


(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()


import sys
(w, h) = map(int, sys.stdin.readline().split())
grid = []
for i in range(h):
	grid.append(sys.stdin.readline().strip())
for j in range(w):
	res = []
	for i in range(h):
		res.append(grid[i][j] * 2)
	sys.stdout.write(''.join(res) + '\n')
	sys.stdout.write(''.join(res) + '\n')


(w, h) = [int(x) for x in input().split()]
ori = []
for i in range(h):
	l = list(input())
	ori.append(l)
ro = []
for i in range(w):
	l = []
	for j in range(h):
		l.append(ori[j][i])
	ro.append(l)
du1 = []
for i in range(w):
	l = []
	for j in range(0, 2 * h):
		l.append(ro[i][int(j / 2)])
	du1.append(l)
du2 = []
for i in range(0, 2 * w):
	du2.append(du1[int(i / 2)])
for i in range(len(du2)):
	print(''.join(du2[i]))


def povorot(a, b):
	for i in range(m + 1):
		for j in range(n + 1):
			b[j][i] = a[i][j]

def otr(b, c):
	for i in range(1, m + 1):
		for j in range(1, n + 1):
			c[j - 1][i - 1] = b[j][i]

def mashtab(c, d, e):
	r = 0
	for i in range(n):
		tmp = ''.join(c[i])
		for j in range(len(tmp)):
			d[r][j] = tmp[j]
			d[r + 1][j] = tmp[j]
		r = r + 2
	r = 0
	for i in range(m):
		for j in range(2 * n):
			e[j][r] = d[j][i]
			e[j][r + 1] = d[j][i]
		r = r + 2
(n, m) = map(int, input().split())
a = [[0] * (n + 1) for i in range(m + 1)]
for i in range(1, m + 1):
	tmp = input()
	tmp.rstrip()
	for j in range(len(tmp)):
		a[i][j + 1] = tmp[j]
b = [[0] * (m + 1) for i in range(n + 1)]
povorot(a, b)
c = [[0] * m for i in range(n)]
otr(b, c)
d = [[0] * (2 * m) for i in range(2 * n)]
e = [[0] * (2 * m) for i in range(2 * n)]
mashtab(c, d, e)
for i in range(len(e)):
	for j in range(len(e[i])):
		print(e[i][j], end='')
	print()


import sys
(w, h) = map(int, sys.stdin.readline().split())
izn = [''] * h
for i in range(h):
	izn[i] = input()
nov = [''] * w
for i in range(0, w):
	for j in range(h - 1, -1, -1):
		nov[i] += izn[j][i]
	nov[i] = nov[i][::-1]
	g = ''
	for j in range(h):
		g += nov[i][j] * 2
	for i in range(2):
		print(g)


(w, h) = input().split()
w = int(w)
h = int(h)
a = list()
for i in range(h):
	row = input()
	a.append(row)
b = [['0' for i in range(h)] for j in range(w)]
for i in range(h):
	for j in range(w):
		b[j][i] = a[i][j]
s = str()
c = list()
for j in range(w):
	for i in range(h):
		s = s + b[j][i] + b[j][i]
	c.append(s)
	s = ''
for i in range(w):
	print(c[i])
	print(c[i])


(n, m) = map(int, input().split())
array = []
array1 = []
array2 = []
for i in range(m):
	s = input()
	array += [s]
for j in range(n):
	s = ''
	for i in range(m):
		s += array[i][j]
	array1 += [s]
	array2 += [s]
q = len(array1)
array = []
for i in range(q):
	array += [array1[i]]
	array += [array2[i]]
array1 = []
for i in range(2 * n):
	s = ''
	for j in range(m):
		s += array[i][j]
		s += array[i][j]
	array1 += [s]
for i in range(len(array)):
	print(array1[i])


def rot(x):
	matrix = [[0] * h for i in range(w)]
	for i in range(w):
		for j in range(h):
			matrix[i][j] = x[h - 1 - j][i]
	return matrix

def mir(x):
	matrix = [[0] * h for i in range(w)]
	for i in range(w):
		for j in range(h):
			matrix[i][j] = x[i][h - j - 1]
	return matrix

def scale(x):
	matrix = [[0] * 2 * h for i in range(w * 2)]
	for i in range(2 * w):
		for j in range(2 * h):
			matrix[i][j] = x[i // 2][j // 2]
	return matrix
(w, h) = map(int, input().split())
x = []
for i in range(h):
	x.append(list(input()))
x = scale(mir(rot(x)))
for i in x:
	print(''.join(i))


(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] = [int(x) for x in input().split()]
matrix_photo = [[x for x in input()] for y in range(h)]

def print_matrix(matrix):
	for row in matrix:
		print(''.join(row))

def rotate(matrix):
	h = len(matrix)
	w = len(matrix[0])
	result = []
	for i in range(w):
		column = [matrix[j][i] for j in range(h)]
		result.append(column)
	return result
rotated = rotate(matrix_photo)

def flip(matrix):
	h = len(matrix)
	w = len(matrix[0])
	result = []
	for i in range(h):
		row = matrix[i]
		new_row = row[::-1]
		result.append(new_row)
	return result
fliped = flip(rotated)

def zoom(matrix):
	h = len(matrix)
	w = len(matrix[0])
	result = []
	for row in matrix:
		new_row = []
		for i in range(w):
			new_row.append(row[i])
			new_row.append(row[i])
		result.append(new_row)
		result.append(new_row)
	return result
zoomed = zoom(fliped)
final = flip(zoomed)
print_matrix(final)


(w, h) = map(int, input().split())
a = []
for i in range(h):
	a.append(input())
a = [''.join((a[j][i] for j in range(h))) for i in range(w)]
for row in a:
	ls = []
	for c in row:
		ls.extend((c, c))
	s = ''.join(ls)
	print(s, s, sep='\n')


import sys

def main():
	(w, h) = [int(i) for i in input().split()]
	p = []
	for i in range(h):
		s = input()
		p.append(s)
	for i in range(w):
		for j in range(h):
			print(p[j][i] + p[j][i], end='')
		print()
		for j in range(h):
			print(p[j][i] + p[j][i], end='')
		print()
main()


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))


s = input()
w = ''
h = ''
b = True
s = list(s)
for f in s:
	if not b:
		h += f
	if f != ' ' and b:
		w += f
	else:
		b = False
w = int(w)
h = int(h)
simbolos = []
for e in range(0, h):
	simbolos.append([])
	caracteres = input()
	for n in caracteres:
		simbolos[e].append(n)
simbolos2 = []
for e in range(0, w):
	simbolos2.append([])
	for i in range(0, h):
		simbolos2[e].append(i)
j = h - 1
for x in range(0, h):
	for y in range(0, w):
		simbolos2[y].pop(j)
		simbolos2[y].insert(j, simbolos[x][y])
	j -= 1
simbolos3 = []
for e in simbolos2:
	e.reverse()
	simbolos3.append(e)
for e in simbolos3:
	letras = ''
	for i in e:
		letras += str(i) * 2
	print(letras)
	print(letras)


def main():
	(w, h) = map(int, input().split())
	h *= 2
	l = [None] * h
	for i in range(0, h, 2):
		l[i] = l[i + 1] = input()
	l = [''.join(_) for _ in zip(*l)]
	for s in l:
		print(s)
		print(s)
main()


[w, h] = [int(x) for x in input().split()]
image = []
for i in range(h):
	image.append(input())
for x in range(w * 2):
	for y in range(h * 2):
		final_x = int(y / 2)
		final_y = int(x / 2)
		final_x = h - final_x - 1
		temp_y = final_y
		temp_x = final_x
		final_x = temp_y
		final_y = h - temp_x - 1
		print(image[final_y][final_x], end='')
	print('')


(w, h) = map(int, input().split())
l = [''] * h
for i in range(h):
	l[i] = input()
n = [''] * w
for i in range(0, w):
	for x in range(h - 1, -1, -1):
		n[i] += l[x][i]
	n[i] = n[i][::-1]
	f = ''
	for z in range(h):
		f += n[i][z] * 2
	print(f)
	print(f)


(w, h) = [int(i) for i in input().split()]
pic = [list(input()) for i in range(h)]
pic1 = [[None] * h for i in range(w)]
for i in range(h):
	for j in range(w):
		pic1[j][i] = pic[i][j]
pic3 = [[None] * 2 * h for i in range(2 * w)]
for i in range(w):
	for j in range(h):
		pic3[2 * i][2 * j] = pic1[i][j]
		pic3[2 * i + 1][2 * j] = pic1[i][j]
		pic3[2 * i][2 * j + 1] = pic1[i][j]
		pic3[2 * i + 1][2 * j + 1] = pic1[i][j]
for i in range(2 * w):
	for j in range(2 * h):
		print(pic3[i][j], end='')
	print()


(w, h) = input().split()
(w, h) = (int(w), int(h))
S = []
for i in range(0, h):
	ts = input()
	S += [ts]
for i in range(0, 2 * w):
	idxi = i // 2
	tans = ''
	for j in range(0, 2 * h):
		idxj = j // 2
		tans += S[idxj][idxi]
	print(tans)


def transpose(a):
	(h, w) = (len(a), len(a[0]))
	b = [[0 for j in range(h)] for i in range(w)]
	for i in range(h):
		for j in range(w):
			b[j][i] = a[i][j]
	return b

def read_field(lines_raw):
	lines = list(filter(lambda x: len(x) > 0, map(lambda y: y.strip(), lines_raw)))
	return [list(x) for x in lines]

def magnify(a, factor=2):
	(h, w) = (len(a), len(a[0]))
	b = [['#' for j in range(factor * w)] for i in range(factor * h)]
	for i in range(h):
		for j in range(w):
			for dx in range(factor):
				for dy in range(factor):
					b[factor * i + dx][factor * j + dy] = a[i][j]
	return b

def dump(a):
	return '\n'.join((''.join((x for x in row)) for row in a))
(a, b) = input().split()
lines = []
for _ in range(int(b)):
	lines.append(input())
print(dump(magnify(transpose(read_field(lines)))))


(w, h) = map(int, input().split())
help = [input() for i in range(h)]
data = [[None for i in range(h)] for j in range(w)]
for i in range(w):
	for j in range(h):
		data[i][j] = help[j][i]
for i in range(w):
	a = ''
	for j in range(len(data[i])):
		a += 2 * data[i][j]
	print(a)
	print(a)


(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')


(w, h) = [int(s) for s in input().split()]
mas = [[' '] * 100 for i in range(100)]
for i in range(h):
	j = 0
	for ch in input():
		mas[j][i] = ch
		j += 1
for i in range(w):
	s = ''
	for j in range(h):
		s += mas[i][j] * 2
	print(s)
	print(s)


(W, H) = map(int, input().split())
mat = [input() for i in range(H)]
for i in range(2 * W):
	print(''.join((mat[j // 2][i // 2] for j in range(2 * H))))


size = input().split()
w = int(size[0])
h = int(size[1])
image = []
for i in range(h):
	row = []
	for c in input():
		row.append(c)
	image.append(row)
for i in range(w):
	row = []
	for k in range(h):
		row.append(image[k][i] * 2)
	str_row = ''.join(row)
	print(str_row)
	print(str_row)


class Image(object):

	def __init__(self, width, height, stringImage):
		self._width = width
		self._height = height
		self._stringImage = stringImage
		self._pixelMatrix = [[]]
		line = 0
		for i in self._stringImage:
			if i == '\n':
				self._pixelMatrix.append([])
				line += 1
			else:
				self._pixelMatrix[line].append(i)

	def __str__(self):
		resultedString = ''
		for line in self._pixelMatrix:
			for j in line:
				resultedString += j
			resultedString += '\n'
		return resultedString[:-1]

	def rotate90right(self):
		newPixelMatrix = []
		for i in range(self._width):
			newPixelMatrix.append([])
			for j in range(self._height):
				newPixelMatrix[i].append('.')
		for i in range(self._height):
			for j in range(self._width):
				newPixelMatrix[j][self._height - 1 - i] = self._pixelMatrix[i][j]
		self._pixelMatrix = newPixelMatrix
		temp = self._height
		self._height = self._width
		self._width = temp

	def mirrorGorizont(self):
		newPixelMatrix = []
		for i in range(self._height):
			newPixelMatrix.append([])
			for j in range(self._width):
				newPixelMatrix[i].append('.')
		for i in range(self._height):
			for j in range(self._width):
				newPixelMatrix[i][self._width - 1 - j] = self._pixelMatrix[i][j]
		self._pixelMatrix = newPixelMatrix

	def doubleTheSize(self):
		newPixelMatrix = []
		for i in range(self._height * 2):
			newPixelMatrix.append([])
			for j in range(self._width * 2):
				newPixelMatrix[i].append('.')
		for i in range(self._height):
			for j in range(self._width):
				newPixelMatrix[i * 2][j * 2] = self._pixelMatrix[i][j]
				newPixelMatrix[i * 2][j * 2 + 1] = self._pixelMatrix[i][j]
				newPixelMatrix[i * 2 + 1][j * 2] = self._pixelMatrix[i][j]
				newPixelMatrix[i * 2 + 1][j * 2 + 1] = self._pixelMatrix[i][j]
		self._pixelMatrix = newPixelMatrix
		self._height *= 2
		self._width *= 2
inputString = input()
listOfInput = inputString.split()
width = -1
height = -1
for i in listOfInput:
	if i.isdigit() and width == -1:
		width = int(i)
	elif i.isdigit():
		height = int(i)
image = input()
for i in range(height - 1):
	image += '\n'
	image += input()
a = Image(width, height, image)
a.doubleTheSize()
a.rotate90right()
a.mirrorGorizont()
print(a)