#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	char hyou[8][8];
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cin >> hyou[i][j];
		}
	}

	cout << "90" << endl;
	for (int i = 0; i < 8; i++) {
		for (int j = 7; j >= 0; j--) {
			cout << hyou[j][i];
		} 
		cout << endl;
	}

	cout << "180" << endl;
	for (int i = 7; i >= 0; i--) {
		for (int j = 7; j >= 0; j--) {
			cout << hyou[i][j];
		}
		cout << endl;
	}

	cout << "270" << endl;
	for (int i = 7; i >= 0; i--) {
		for (int j = 0; j < 8; j++) {
			cout << hyou[j][i];
		}
		cout << endl;
	}
	return 0;
}