#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()


int main(void){
  vector<string > buf(8);
  rep(i,8){
    cin>>buf[i];
  }


  cout<<"90"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[7-i][j];
    }
    cout<<endl;
  }

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

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