#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main()
{
    vector<vector<string> > s(2, vector<string>(8, string(8, '.')));
    rep(i, 8) cin >> s[0][i];
    rep(k, 3) {
        cout << 90 * (k + 1) << endl;
        rep(i, 8) rep(j, 8) s[(k+1)%2][i][j] = s[k%2][7-j][i];
        rep(i, 8) cout << s[(k+1)%2][i] << endl;
    }
    return 0;
}