Problem: 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
*******#
*******#
*******#
*******#
*******#
*******#
*******#

Solution (in CPP):

Solution:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;
typedef vector<vector<char> > matrix;

void print(matrix& mat) {
	REP(y, mat.size()) {
		REP(x, mat[0].size()) {
			cout << mat[y][x];
		}
		cout << endl;
	}
}

matrix mk_matrix(int n, int m) {
	matrix mat(n);
	REP(i, n) {
		mat[i] = vector<char>(m, 0);
	}
	return mat;
}

void rotate90(matrix& src) {
	matrix dst = mk_matrix(8, 8);
	REP(y, 8) {
		REP(x, 8) {
			dst[x][8 - y - 1] = src[y][x];
		}
	}
	src = dst;
}

bool AOJ0133()
{
	matrix mat = mk_matrix(8, 8);
	REP(i, 8) {
		REP(j, 8) {
			cin >> mat[i][j];
		}
	}
	cout << "90" << endl;
	rotate90(mat);
	print(mat);
	cout << "180" << endl;
	rotate90(mat);
	print(mat);
	cout << "270" << endl;
	rotate90(mat);
	print(mat);

	return true;
}

int main()
{
	AOJ0133();

	return 0;
}