Create a program that rotates the pattern of 8 characters x 8 lines clockwise by 90 degrees, 180 degrees, and 270 degrees and outputs it.



Input

A pattern consisting of 8 characters x 8 lines is given. Characters consist of alphanumeric characters, half-width pound'#', and asterisk'*'.

Output

Output the rotated pattern in the following format.


90 (fixed half-width numbers)
Pattern rotated 90 degrees
180 (fixed half-width numbers)
180 degree rotated pattern
270 (fixed half-width numbers)
Pattern rotated 270 degrees


Examples

Input

#*******
#*******
#*******
#*******
#*******
#*******
#*******
########


Output

90
########
#*******
#*******
#*******
#*******
#*******
#*******
#*******
180
########
*******#
*******#
*******#
*******#
*******#
*******#
*******#
270
*******#
*******#
*******#
*******#
*******#
*******#
*******#
########


Input

*******
*******
*******
*******
*******
*******
*******


Output

90

*******
*******
*******
*******
*******
*******
*******
180

*******#
*******#
*******#
*******#
*******#
*******#
*******#
270
*******#
*******#
*******#
*******#
*******#
*******#
*******#

Source: aizu | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
a = [[[0 for c in range(8)] for r in range(8)] for k in range(4)]
title = ['0', '90', '180', '270']
for r in range(8):
	a[0][r] = list(input())
for k in range(1, 4):
	print(title[k])
	for r in range(8):
		for c in range(8):
			a[k][c][7 - r] = a[k - 1][r][c]
	for r in range(8):
		print(*a[k][r], sep='')


m = [input() for _ in range(8)]
for i in [90, 180, 270]:
	m = list(zip(*m[::-1]))
	print(i)
	for x in m:
		print(''.join(x))


mat = []
for _ in range(8):
	mat.append(list(input()))
mat90 = [[0 for i in range(8)] for j in range(8)]
print(90)
for i in range(8):
	for j in range(8):
		mat90[i][j] = mat[7 - j][i]
for i in range(8):
	print(''.join((m for m in mat90[i])))
mat180 = [[0 for i in range(8)] for j in range(8)]
print(180)
for i in range(8):
	for j in range(8):
		mat180[i][j] = mat90[7 - j][i]
for i in range(8):
	print(''.join((m for m in mat180[i])))
mat270 = [[0 for i in range(8)] for j in range(8)]
print(270)
for i in range(8):
	for j in range(8):
		mat270[i][j] = mat180[7 - j][i]
for i in range(8):
	print(''.join((m for m in mat270[i])))


def rotate(k, p):
	q = []
	print('90' if k == 1 else '180' if k == 2 else '270')
	for i in range(8):
		t = ''
		for j in range(8)[::-1]:
			print(p[j][i], end='')
			t += p[j][i]
		q.append(t)
		print()
	return q
p = [input() for _ in range(8)]
for i in range(1, 4):
	p = rotate(i, p)


MAX = 8
L = [[None] * MAX for x in range(MAX)]
for i in range(MAX):
	l = list(input())
	L[i] = l
T = [[None] * MAX for x in range(MAX)]
for r in range(1, 4):
	print(r * 90)
	for i in range(MAX):
		for j in range(MAX):
			T[i][j] = L[MAX - 1 - j][i]
	L = T
	T = [[None] * MAX for x in range(MAX)]
	for l in L:
		print(''.join(l))


def Draw(pattern, rowRange, colRange):
	s = ''
	for row in rowRange:
		for col in colRange:
			s += pattern[row][col]
		s += '\n'
	print(s, end='')

def Draw2(pattern, colRange, rowRange):
	s = ''
	for col in colRange:
		for row in rowRange:
			s += pattern[row][col]
		s += '\n'
	print(s, end='')
pattern = [input() for lp in range(8)]
print('90')
Draw2(pattern, range(0, 8), range(7, -1, -1))
print('180')
Draw(pattern, range(7, -1, -1), range(7, -1, -1))
print('270')
Draw2(pattern, range(7, -1, -1), range(0, 8))


table = []
for l in range(8):
	table.append(input())
print(90)
for i in range(8):
	for j in range(8):
		print(table[7 - j][i], end='')
	print('')
print(180)
for i in range(8):
	for j in range(8):
		print(table[7 - i][7 - j], end='')
	print('')
print(270)
for i in range(8):
	for j in range(8):
		print(table[j][7 - i], end='')
	print('')


import sys
from sys import stdin
input = stdin.readline

def rotate_ccw(data):
	A = [[''] * 8 for _ in range(8)]
	for i in range(8):
		for j in range(8):
			A[i][j] = data[j][7 - i]
	for l in A:
		print(''.join(l))
	return A

def rotate_cw(data):
	A = [[''] * 8 for _ in range(8)]
	for i in range(8):
		for j in range(8):
			A[i][j] = data[7 - j][i]
	for l in A:
		print(''.join(l))
	return A

def main(args):
	data = []
	for _ in range(8):
		data.append(list(input().strip()))
	print('90')
	data = rotate_cw(data)
	print('180')
	data = rotate_cw(data)
	print('270')
	data = rotate_cw(data)
main(sys.argv[1:])


m = [input() for _ in range(8)]
print(90)
a = -1
for j in range(8):
	for i in range(7, a, a):
		print(m[i][j], end='')
	print()
print(180)
for i in range(7, a, a):
	for j in range(7, a, a):
		print(m[i][j], end='')
	print()
print(270)
for j in range(7, a, a):
	for i in range(8):
		print(m[i][j], end='')
	print()


def spin(p):
	ret = [[None] * 8 for _ in range(8)]
	for i in range(8):
		for j in range(8):
			ret[i][j] = p[7 - j][i]
	return ret

def print_p(p):
	for line in p:
		print(''.join(line))
p = [input() for _ in range(8)]
print(90)
p = spin(p)
print_p(p)
print(180)
p = spin(p)
print_p(p)
print(270)
p = spin(p)
print_p(p)


m = [input() for _ in range(8)]
for i in range(3):
	m = list(zip(*m[::-1]))
	print(90 * (i + 1))
	for x in m:
		print(''.join(x))


t = []
for i in range(8):
	t.append(input())
print(90)
for i in range(8):
	for j in range(8):
		print(t[7 - j][i], end='')
	print('')
print(180)
for i in range(8):
	for j in range(8):
		print(t[7 - i][7 - j], end='')
	print('')
print(270)
for i in range(8):
	for j in range(8):
		print(t[j][7 - i], end='')
	print('')


def spin(pazzule):
	pzl = [['' for i in range(8)] for j in range(8)]
	for i in range(8):
		for j in range(8):
			pzl[i][j] = pazzule[7 - j][i]
	return pzl
pazzule = [list(input()) for i in range(8)]
pazzule = spin(pazzule)
print('90')
for i in range(8):
	print(''.join(pazzule[i]))
print('180')
pazzule = spin(pazzule)
for i in range(8):
	print(''.join(pazzule[i]))
print('270')
pazzule = spin(pazzule)
for i in range(8):
	print(''.join(pazzule[i]))


def rotate(m, n):
	print(90 * n)
	for i in range(8):
		print(''.join(m[i]), end='')
		print()
m = [input() for _ in range(8)]
for i in range(3):
	m = list(zip(*m[::-1]))
	rotate(m, i + 1)


def spin(p):
	ret = [[None] * 8 for _ in range(8)]
	for i in range(8):
		for j in range(8):
			ret[i][j] = p[7 - j][i]
	return ret

def print_p(p):
	for line in p:
		print(''.join(line))
p = [input() for _ in range(8)]
print(90)
p = spin(p)
print_p(p)
print(180)
p = spin(p)
print_p(p)
print(270)
p = spin(p)
print_p(p)