#include <stdio.h>
char c[8][9], d[8][9];
int main() {
	for (int i = 0; i < 8; i++) scanf("%s", c[i]);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 8; j++) {
			for (int k = 0; k < 8; k++) {
				d[i][j] = c[7 - j][i];
			}
		}
		for (int j = 0; j < 8; j++) {
			for (int k = 0; k < 8; k++) {
				printf("%c", c[i][j] = d[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}