#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

vector<string> s(8);
int dh[8] = { -1,-1,0,1,1,1,0,-1 };
int dw[8] = { 0,1,1,1,0,-1,-1,-1 };
ll change_cnt(ll sh, ll sw, ll turn) {
	char me = 'o';
	char you = 'x';
	if (turn == 1) me = 'x', you = 'o';
	ll cnt[8] = {};
	ll res = 0;
	for (ll i = 0; i < 8; i++) {
		ll tmp = 0;
		ll h = sh + dh[i];
		ll w = sw + dw[i];
		while (h < 8 && w < 8 && h >= 0 && w >= 0) {
			if (s[h][w] == you) tmp++;
			else if (s[h][w] == me) {
				cnt[i] = tmp;
				break;
			}
			else break;
			h += dh[i];
			w += dw[i];
		}
		res += cnt[i];
	}
	return res;
}

void change(ll sh, ll sw, ll turn) {
	char me = 'o';
	char you = 'x';
	if (turn == 1) me = 'x', you = 'o';
	ll cnt[8] = {};
	ll res = 0;
	for (ll i = 0; i < 8; i++) {
		ll tmp = 0;
		ll h = sh + dh[i];
		ll w = sw + dw[i];
		while (h < 8 && w < 8 && h >= 0 && w >= 0) {
			if (s[h][w] == you) tmp++;
			else if (s[h][w] == me) {
				cnt[i] = tmp;
				break;
			}
			else {
				break;
			}
			h += dh[i];
			w += dw[i];
		}
		if (cnt[i] > 0) {
			//cout << sh << " " << sw << endl;
			s[sh][sw] = me;
			ll h = sh + dh[i];
			ll w = sw + dw[i];
			while (h < 8 && w < 8 && h >= 0 && w >= 0) {
				if (s[h][w] == you) s[h][w] = me;
				else break;
				h += dh[i];
				w += dw[i];
			}
		}
	}
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	for (ll i = 0; i < 8; i++) cin >> s[i];
	int turn = 0;
	int zero = 0;
	while (zero < 2) {
		ll mx = 0;
		if (turn == 0) {
			for (int i = 0; i < 8; i++) {
				for (int j = 0; j < 8; j++) {
					if (s[i][j] == '.') {
						//cout << i << " " << j << " "<< change_cnt(i,j,turn) << endl;
						chmax(mx, change_cnt(i, j, turn));
					}
				}
			}
			if (mx == 0) {
				zero++;
			}
			else {
				zero = 0;
				bool flag = false;
				for (ll i = 0; i < 8; i++) {
					for (ll j = 0; j < 8; j++) {
						if (s[i][j] == '.' && mx == change_cnt(i, j, turn)) {

							change(i, j, turn);
							flag = true;
							break;
						}
					}
					if (flag) break;
				}
			}
		}
		else {
			//cout << mx << endl;
			for (int i = 7; i >= 0; i--) {
				for (int j = 7; j >= 0; j--) {
					if (s[i][j] == '.') {
						chmax(mx, change_cnt(i, j, turn));
					}
				}
			}
			if (mx == 0) {
				zero++;
			}
			else {
				zero = 0;
				bool flag = false;
				for (ll i = 7; i >= 0; i--) {
					for (ll j = 7; j >= 0; j--) {
						if (s[i][j] == '.' && mx == change_cnt(i, j, turn)) {
							change(i, j, turn);
							flag = true;
							break;
						}
					}
					if (flag) break;
				}
			}
		}
		//for (ll i = 0; i < 8; i++) cout << s[i] << "\n";
		turn = (turn + 1) % 2;
	}
	for (ll i = 0; i < 8; i++) cout << s[i] << "\n";

	return 0;
}


Measured memory_bytes: 3212