#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char a[8][8],b[8][8];
int main(){
rep(i,8)cin>>a[i];
rep(i,8)rep(j,8)b[j][7-i]=a[i][j];
cout<<"90"<<endl;
rep(i,8){rep(j,8){cout<<b[i][j];}cout<<endl;};

rep(i,8)rep(j,8)b[7-i][7-j]=a[i][j];
cout<<"180"<<endl;
rep(i,8){rep(j,8){cout<<b[i][j];}cout<<endl;};

rep(i,8)rep(j,8)b[7-j][i]=a[i][j];
cout<<"270"<<endl;
rep(i,8){rep(j,8){cout<<b[i][j];}cout<<endl;};

return 0;
}