import std.stdio;
import std.string;

string[8] s;

void main(){
	foreach (i; 0..8) s[i] = chomp(readln());
	writeln("90");
	foreach (i; 0..8) {
		foreach (j; 0..8) {
			write(s[7-i][j]);
		}
		writeln();
	}
	writeln("180");
	foreach (i; 0..8) {
		foreach (j; 0..8) {
			write(s[7-i][7-j]);
		}
		writeln();
	}
	writeln("270");
	foreach (i; 0..8) {
		foreach (j; 0..8) {
			write(s[i][7-j]);
		}
		writeln();
	}
}