#include<iostream>
int i,j;main(){std::string s[8],t;for(;i<8;)getline(std::cin,s[i++]);for(t="90\n";i-->0;t+="\n")for(j=8;j-->0;)t+=s[j][7-i];for(t+="180\n";++i<8;t+="\n")for(j=8;j-->0;)t+=s[7-i][j];for(t+="270\n";i-->0;t+="\n")for(j=0;j<8;)t+=s[j++][i];std::cout<<t;}