#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair

using namespace std;
typedef long long ll;

vector<string> v(8);

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

bool can(int y,int x) {
    if(0 <= y && y < n && 0 <= x && x < n) return true;
    return false;
}

vector<pair<pair<int,pair<int,int> >,pair<int,pair<int,int> > > > vv;

int res = 0;

int main() {
    rep(i,n) cin >> v[i];

    int cnt = -1;
    int check = 0;

    while(true) {
        vv.clear();
        cnt++;
        
        vector<pair<int,pair<int,int> > > vvv;
        rep(i,n) {
            rep(j,n) {

                if(cnt%2 == 0 && v[i][j] == '.') {
                    res = 0;
                    rep(k,8) {
                        int ni = i;
                        int nj = j;
                        int s = 0;
                        
                        while(can(ni+dy[k],nj+dx[k]) && v[ni+dy[k]][nj+dx[k]] == 'x') {
                            s++;
                            ni += dy[k];
                            nj += dx[k];
                        }
                        
                        int gi = ni + dy[k];
                        int gj = nj + dx[k];

                        if(can(gi,gj) && v[gi][gj] == 'o') {
                            res += s;
                        }
                    }

                    if(res > 0) {
                        vvv.push_back(mp(-res,mp(i,j)));
                    }
                }

                if(cnt%2 == 1 && v[i][j] == '.') {
                    res = 0;
                    rep(k,8) {
                        int ni = i;
                        int nj = j;
                        int s = 0;

                        while(can(ni+dy[k],nj+dx[k]) && v[ni+dy[k]][nj+dx[k]] == 'o') {
                            s++;
                            ni += dy[k];
                            nj += dx[k];
                        }

                        int gi = ni + dy[k];
                        int gj = nj + dx[k];

                        if(can(gi,gj) && v[gi][gj] == 'x') {
                            res += s;
                        }
                    }

                    if(res > 0) {
                        vvv.push_back(mp(-res,mp(-i,-j)));
                    }
                }
            }
        }

        if(vvv.size() != 0) {
            sort(vvv.begin(),vvv.end());
            
            int i = vvv[0].second.first;
            int j = vvv[0].second.second;
            check = 0;

            if(cnt%2 == 0) {
                rep(k,8) {
                    int ni = i;
                    int nj = j;
                    int len = 0;

                    while(can(ni+dy[k],nj+dx[k]) && v[ni+dy[k]][nj+dx[k]] == 'x') {
                        len++;
                        ni += dy[k];
                        nj += dx[k];
                    }

                    int gi = ni + dy[k];
                    int gj = nj + dx[k];

                    if(can(gi,gj) && v[gi][gj] == 'o') {
                        ni = i;
                        nj = j;

                        rep(l,len+1) {
                            v[ni][nj] = 'o';
                            ni += dy[k];
                            nj += dx[k];
                        }
                    }
                }
            }
            else {
                i *= -1;
                j *= -1;

                rep(k,8) {
                    int ni = i;
                    int nj = j;
                    int len = 0;

                    while(can(ni+dy[k],nj+dx[k]) && v[ni+dy[k]][nj+dx[k]] == 'o') {
                        len++;
                        ni += dy[k];
                        nj += dx[k];
                    }

                    int gi = ni + dy[k];
                    int gj = nj + dx[k];

                    if(can(gi,gj) && v[gi][gj] == 'x') {
                        ni = i;
                        nj = j;

                        rep(l,len+1) {
                            v[ni][nj] = 'x';
                            ni += dy[k];
                            nj += dx[k];
                        }
                    }
                }
            }
        }else {
            check++;
            if(check == 2) break;
        }
    }

    rep(i,8) cout << v[i] << endl;

    return 0;
}

Measured memory_bytes: 1192