#include <iostream>
#include <string>

using namespace std;

int main(){
  string strs[8];
  for(int i = 0; i < 8; i++){
    cin >> strs[i];
  }
  cout << 90 << "\n";
  for(int i = 0; i < 8; i++){
    for(int j = 7; j >= 0; j--){
      cout << strs[j][i];
    }
    cout << "\n";
  }
  cout << 180 << "\n";
  for(int i = 7; i >= 0; i--){
    for(int j = 7; j >= 0; j--){
      cout << strs[i][j];
    }
    cout << "\n";
  }
  cout << 270 << "\n";
  for(int i = 0; i < 8; i++){
    for(int j = 7; j >= 0; j--){
      cout << strs[i][j];
    }
    cout << "\n";
  }
  return 0;
}