#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define sz(obj) ((int)(obj).size())
#define pf push_front
#define pb push_back

int main()
{
  char a[8][8];
  REP(i, 8){
    REP(j, 8) cin >> a[i][j];
  }
  cout << 90 << endl;
  RREP(i, 8){
    REP(j, 8) cout << a[i][j];
    cout << endl;
  }
  cout << 180 << endl;
  RREP(i, 8){
    RREP(j, 8) cout << a[i][j];
    cout << endl;
  }
  cout << 270 << endl;
  REP(i, 8){
    RREP(j, 8) cout << a[i][j];
    cout << endl;
  }
}