#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

string s[8];
int dx[] = {-1, 0, 1, 1, 1, 0, -1, -1}, dy[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int f1(int x, int y, bool ismami, int v) {
	int ret = 0;
	bool fl = false;
	while(true) {
		x += dx[v]; y += dy[v];
		if(x < 0 || x >= 8 || y < 0 || y >= 8 || s[y][x] == '.') return 0;
		if(s[y][x] == (ismami ? 'x' : 'o')) {
			ret++;
		}
		if(s[y][x] == (ismami ? 'o' : 'x')) {
			fl = true;
			break;
		}
	}
	if(fl) return ret;
	return 0;
}

void f2(int x, int y, bool ismami, int v) {
	while(true) {
		x += dx[v]; y += dy[v];
		if(s[y][x] == (ismami ? 'x' : 'o')) {
			s[y][x] = (ismami ? 'o' : 'x');
		} else {
			break;
		}
	}
}

signed main(void)
{
	REP(i, 8) cin >> s[i];

	bool mami = true, end = false;
	//???????????¶??????????????´???????????????????????????????????????
	while(true) {
		//????????????????????????
		if(mami) {
			int ma = 0, x = -1, y = -1;
			//?????????????????????????????¨???????????¢???
			//(i, j)??????????????¨???
			REP(i, 8) REP(j, 8) {
				if(s[i][j] != '.') continue;
				//(i, j)???????????????????????°?????¢?´¢
				int tmp = 0;
				REP(k, 8) {
					tmp += f1(j, i, mami, k);
				}
				if(tmp > ma) {
					ma = tmp;
					x = j;
					y = i;
				}
				//cout << i << " " << j << " " << tmp << endl;
			}
			//cout << "mami" << x << " " << y << endl;
			if(x == -1 && y == -1) {
				if(end) break;
				end = true;
			} else {
				end = false;
			}
			//(y, x)??????????????¨????????????????????¶???
			if(!end) {
				s[y][x] = 'o';
				REP(i, 8) {
					if(f1(x, y, mami, i) >= 1) f2(x, y, mami, i);
				}
			}
			//cout << (mami ? "mami " : "majo ") << x << " " << y << " " << ma << endl;
			mami = false;
		} else {
			int ma = 0, x = -1, y = -1;
			//?????????????????????????????¨???????????¢???
			//(i, j)??????????????¨???
			for(int i=7; i>=0; --i) {
				for(int j=7; j>=0; --j) {
					if(s[i][j] != '.') continue;
					//(i, j)???????????????????????°?????¢?´¢
					int tmp = 0;
					REP(k, 8) {
						tmp += f1(j, i, mami, k);
					}
					if(tmp > ma) {
						ma = tmp;
						x = j;
						y = i;
					}
				}
			}
			//cout << "majo" << x << " " << y << endl;
			if(x == -1 && y == -1) {
				if(end) break;
				end = true;
			} else {
				end = false;
			}
			if(!end) {
				//(y, x)??????????????¨????????????????????¶???
				s[y][x] = 'x';
				REP(i, 8) {
					if(f1(x, y, mami, i) >= 1) f2(x, y, mami, i);
				}
			}
			//cout << (mami ? "mami" : "majo") << x << " " << y << " " << ma << endl;
			mami = true;
		}
		//REP(i, 8) cout << s[i] << endl;
		//cout << "a " << (end ? "true " : "false ") << (mami ? "mami" : "majo") << endl;
	}

	REP(i, 8) cout << s[i] << endl;

	return 0;
}

Measured memory_bytes: 3208