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:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

vector <string> rotate90 (vector <string> src )
{
	int size = src.size();
	vector <string> res (8, string(8, ' ' ) );

	int i,j;
	
	for (i = 0; i < size; ++i){
		for (j = 0; j < size; ++j){
			res[j][size - 1 - i] = src[i][j];
 		} // end for
	} // end for

	return res;
}

void disp_pattern (vector <string> p )
{
	int size = p.size();
	int i,j;

	for (i = 0; i < size; ++i){
		for (j = 0; j < size; ++j){
			cout << p[i][j];
		} // end for
		cout << endl;
	} // end for
}

int main()
{
	const string ang[] = { "90", "180", "270" };

//	cut here before submit 
//	freopen ("testcase.pattern", "r", stdin );
	string str = "";
	vector <string> pattern (8);
	int i;
	
	for (i = 0; i < 8; ++i){
		getline (cin, str );
		pattern[i] = str;
	} // end for

	vector <string> res;

	// for debug
//	disp_pattern (pattern );

	for (i = 0; i < 3; ++i){
		res = rotate90 (pattern );
		cout << ang[i] << endl;
		disp_pattern (res );
		pattern = res;
	} // end for

	return 0;
}