#include <iostream>
#include <vector>

using namespace std;

char p[8][8];

void rotate() 
{
    char bp[8][8];
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            bp[i][j] = p[i][j];
        }
    }

    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            p[i][j] = bp[7 - j][i];
        }
    }
}

void disp()
{
    for (int i = 0; i < 8; i++){ 
        for (int j = 0; j < 8; j++) {
            cout << p[i][j];
        }
        cout << endl;
    }
}

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

    cout << "90" << endl;
    rotate();
    disp();

    cout << "180" << endl;
    rotate();
    disp();

    cout << "270" << endl;
    rotate();
    disp();

    
}