#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAX = 8;

string s[MAX];

int main()
{
    REP(MAX) cin >> s[i];

    cout << "90"<< endl;
    rep(j,MAX){rep(i,MAX) cout << s[MAX-i-1][j]; cout << endl;}

    cout << "180" << endl;
    rep(i,MAX){rep(j,MAX) cout << s[MAX-i-1][MAX-j-1]; cout << endl;}

    cout << "270" << endl;
    rep(j,MAX){rep(i,MAX) cout << s[i][MAX-j-1]; cout << endl;}

    return 0;
}