#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  char in[8][8];
  rep(i,8)cin>>in[i];
  
  cout<<"90"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[7-j][i];
    cout<<endl;
  }
  cout<<"180"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[7-i][7-j];
    cout<<endl;
  }
  cout<<"270"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[j][7-i];
    cout<<endl;
  }
  return 0;
}