#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

char s[8][9];
int main() {
	rep(i, 8)scanf("%s", s[i]);
	puts("90");
	rep(i, 8) {
		for (int j = 7; j >= 0; j--)cout << s[j][i];
		cout << endl;
	}
	puts("180");
	for (int i = 7; i >= 0; i--) {
		for (int j = 7; j >= 0; j--)cout << s[i][j];
		cout << endl;
	}
	puts("270");
	for (int i = 7; i >= 0; i--) {
		rep(j, 8)cout << s[j][i];
		cout << endl;
	}
}