#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

const vector<int> dy = {-1,-1,-1,0,0,1,1,1};
const vector<int> dx = {-1,0,1,-1,1,-1,0,1};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
    vector<vector<char>> S(10, vector<char>(10,'#'));
    rep(i,8) rep(j,8) cin >> S[i+1][j+1];
    int q = 0;
    while (q < 1000) {
        if (q % 2 == 0) {
            int count,fy,fx;
            count = fy = fx = 0;
            for (int i = 1; i <= 8; i++) {
                for (int j = 1; j <= 8; j++) {
                    if (S[i][j] != '.') continue;
                    int z = 0;
                    rep(k,8) {
                        int y = i;
                        int x = j;
                        int p = 0;
                        while (S[y+dy[k]][x+dx[k]] == 'x') {
                            p++;
                            y += dy[k];
                            x += dx[k];
                        }
                        if (S[y+dy[k]][x+dx[k]] == 'o') {
                            z += p;
                        }
                    }
                    if(chmax(count,z)) {
                        fy = i;
                        fx = j;
                    }
                }
            }
            if (count == 0) {
				q++;
				continue;
			} else {
				S[fy][fx] = 'o';
                rep(k,8) {
                    int y = fy;
                    int x = fx;
                    int p = 0;
                    while (S[y+dy[k]][x+dx[k]] == 'x') {
                        S[y+dy[k]][x+dx[k]] = 'o';
                        y += dy[k];
                        x += dx[k];
                        p++;
                    }
                    if (S[y+dy[k]][x+dx[k]] != 'o') {
                        rep(i,p) {
                            S[y][x] = 'x';
                            y -= dy[k];
                            x -= dx[k];
                        }
                    }
                }
            }
        } else {
            int count,fy,fx;
            count = fy = fx = 0;
            for (int i = 8; i >= 1; i--) {
                for (int j = 8; j >= 1; j--) {
                    if (S[i][j] != '.') continue;
                    int z = 0;
                    rep(k,8) {
                        int y = i;
                        int x = j;
                        int p = 0;
                        while (S[y+dy[k]][x+dx[k]] == 'o') {
                            p++;
                            y += dy[k];
                            x += dx[k];
                        }
                        if (S[y+dy[k]][x+dx[k]] == 'x') z += p;
                    }
                    if(chmax(count,z)) {
                        fy = i;
                        fx = j;
                    }
                }
            }
            if (count == 0) {
				q++;
				continue;
			}
            else {
				S[fy][fx] = 'x';
                rep(k,8) {
                    int y = fy;
                    int x = fx;
                    int p = 0;
                    while (S[y+dy[k]][x+dx[k]] == 'o') {
                        S[y+dy[k]][x+dx[k]] = 'x';
                        p++;
                        y += dy[k];
                        x += dx[k];
                    }
                    if (S[y+dy[k]][x+dx[k]] != 'x') {
                        rep(i,p) {
                            S[y][x] = 'o';
                            y -= dy[k];
                            x -= dx[k];
                        }
                    }
                }
            }
        }
        q++;
    }

  rep(i,8) {
    rep(j,8) cout << S[i+1][j+1];
    cout << endl;
  }
}


Measured memory_bytes: 3220