#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	string s[8];
	vector<string> temp;
	rep(i,8)
	{
		cin >> s[i];
	}
	cout << 90 << endl;
	rep(i,8)
	{
		string t = "";
		for(int j=7;j>=0;j--)
		{
			t += s[j][i];
			cout << s[j][i];
		}
		temp.push_back(t);
		cout << endl;
	}
	
	cout << "-------------" << endl;
	rep(i,8)
	{
		rep(j,8)
		{
			cout << temp[i][j];
		}
		cout << endl;
	}
	cout << "------------" << endl;

	cout << 180 << endl;
	rep(i,8)
	{
		rep(j,8)
		{
			cout << s[j][i];
		}
		cout << endl;
	}

	cout << 270 << endl;
	rep(i,8)
	{
		for(int j=7;j>=0;j--)
		{
			cout << s[i][j];
		}
		cout << endl;
	}

	return 0;
}