#include <iostream>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int main() {

	vector< vector<char> > mp(8, vector<char>(8));

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

	bool turn = true;

	bool end = false;

	int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
	int dy[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };

	while (true) {

		int toku = 0;
		P pos = P(-1, -1);

		vector<int> dxy(8, 0);

		if (turn) {
			for (int y = 0; y < 8; y++) {
				for (int x = 0; x < 8; x++) {
					if (mp[y][x] == '.') {
						int ttoku = 0;
						vector<int> tdxy(8, 0);
						for (int k = 0; k < 8; k++) {
							bool hh = false;
							int count = 0;
							P pp = P(x, y);
							while (0 <= pp.first + dx[k] && pp.first + dx[k] < 8 && 0 <= pp.second + dy[k] && pp.second + dy[k] < 8) {
								pp.first += dx[k];
								pp.second += dy[k];
								if (mp[pp.second][pp.first] == 'o') {
									hh = true;
									break;
								} else if (mp[pp.second][pp.first] == 'x') {
									count++;
								}
								else {
									break;
								}
							}
							if (hh) {
								tdxy[k] = 1;
								ttoku += count;
							}
						}
						if (ttoku > toku) {
							toku = ttoku;
							pos.first = x;
							pos.second = y;
							dxy = tdxy;
						}
					}
				}
			}
		}
		else {
			for (int y = 7; y >= 0; y--) {
				for (int x = 7; x >= 0; x--) {
					if (mp[y][x] == '.') {
						int ttoku = 0;
						vector<int> tdxy(8, 0);
						for (int k = 0; k < 8; k++) {
							bool hh = false;
							int count = 0;
							P pp = P(x, y);
							while (0 <= pp.first + dx[k] && pp.first + dx[k] < 8 && 0 <= pp.second + dy[k] && pp.second + dy[k] < 8) {
								pp.first += dx[k];
								pp.second += dy[k];
								if (mp[pp.second][pp.first] == 'x') {
									hh = true;
									break;
								} else if (mp[pp.second][pp.first] == 'o') {
									count++;
								}
								else {
									break;
								}
							}
							if (hh) {
								tdxy[k] = 1;
								ttoku += count;
							}
						}
						if (ttoku > toku) {
							toku = ttoku;
							pos.first = x;
							pos.second = y;
							dxy = tdxy;
						}
					}
				}
			}
		}

		if (toku == 0) {
			if (end) {
				break;
			}
			else {
				end = true;
			}
		}
		else {
			//cout << pos.first << ' ' << pos.second << endl;
			if (turn) {
				mp[pos.second][pos.first] = 'o';
				for (int k = 0; k < 8; k++) {
					if (dxy[k] == 1) {
						P pp = pos;
						while (true) {
							pp.first += dx[k];
							pp.second += dy[k];
							if (mp[pp.second][pp.first] == 'x') {
								mp[pp.second][pp.first] = 'o';
							}
							else {
								break;
							}
						}
					}
				}
			}
			else {
				mp[pos.second][pos.first] = 'x';
				for (int k = 0; k < 8; k++) {
					if (dxy[k] == 1) {
						P pp = pos;
						while (true) {
							pp.first += dx[k];
							pp.second += dy[k];
							if (mp[pp.second][pp.first] == 'o') {
								mp[pp.second][pp.first] = 'x';
							}
							else {
								break;
							}
						}
					}
				}
			}
			end = false;
		}

		turn = !turn;
	}

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

	return 0;
}


Measured memory_bytes: 3148