#include <iostream>

using namespace std;

char inp[10][10];

int main()
{
    for (int i = 0; i < 8; i++)
        cin >> inp[i];

    cout << "90" << endl;
    for (int i = 7; i >= 0; i--)
        cout << inp[i] << endl;

    cout << "180" << endl;
    for (int i = 7; i >= 0; i--) {
        for (int j = 7; j >= 0; j--)
            cout << inp[i][j];
        cout << endl;
    }

    cout << "270" << endl;
    for (int i = 0; i < 8; i++) {
        for (int j = 7; j >= 0; j--)
            cout << inp[i][j];
        cout << endl;
    }
    
    return 0;
}