#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int board[8][8];
int turn[8][8];
int subturn[8][8][8];

bool move(int fre, int ene) {
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (board[i][j] != 0) {
                turn[i][j] = -1;
            } else {
                int turnnum = 0;
                for (int k = 0; k < 8; k++) {
                    int p = 1;
                    bool subok = false;
                    int xx = i + p * dx[k];
                    int yy = j + p * dy[k];
                    while (xx >= 0 && xx < 8 && yy >= 0 && yy < 8) {
                        if (board[xx][yy] == fre) {
                            subok = true;
                            break;
                        } else if (board[xx][yy] == 0) {
                            break;
                        }
                        p++;
                        xx += dx[k];
                        yy += dy[k];
                    }
                    if (subok) {
                        turnnum += p - 1;
                        subturn[i][j][k] = p - 1;
                    } else {
                        subturn[i][j][k] = 0;
                    }
                }
                turn[i][j] = turnnum;
            }
        }
    }
    int maxnum = 0;
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            // if (turn[i][j] == -1) {
            //     cout << "a" << " ";
            // } else {
            //     cout << turn[i][j] << " ";
            // }
            maxnum = max(maxnum, turn[i][j]);
        }
        //cout << endl;
    }
    if (maxnum > 0) {
        bool ok = false;
        if (fre == 1) {
            for (int i = 0; i < 8; i++) {
                for (int j = 0; j < 8; j++) {
                    if (turn[i][j] == maxnum) {
                        board[i][j] = fre;
                        for (int k = 0; k < 8; k++) {
                            for (int l = 1; l <= subturn[i][j][k]; l++) {
                                board[i + l * dx[k]][j + l * dy[k]] = fre;
                            }
                        }
                        ok = true;
                        break;
                    }
                }
                if (ok) {
                    break;
                }
            }
        } else {
            for (int i = 7; i >= 0; i--) {
                for (int j = 7; j >= 0; j--) {
                    if (turn[i][j] == maxnum) {
                        board[i][j] = fre;
                        for (int k = 0; k < 8; k++) {
                            for (int l = 1; l <= subturn[i][j][k]; l++) {
                                board[i + l * dx[k]][j + l * dy[k]] = fre;
                            }
                        }
                        ok = true;
                        break;
                    }
                }
                if (ok) {
                    break;
                }
            }
        }
        return true;
    } else {
        return false;
    }
}

int main() {
    string s;
    int vac = 0;
    for (int i = 0; i < 8; i++) {
        cin >> s;
        for (int j = 0; j < 8; j++) {
            if (s[j] == 'o') {
                board[i][j] = 1;
            } else if (s[j] == 'x') {
                board[i][j] = 2;
            } else {
                board[i][j] = 0;
                vac++;
            }
        }
    }
    while (1) {
        bool tomoe = move(1, 2);
        // for (int i = 0; i < 8; i++) {
        //     for (int j = 0; j < 8; j++) {
        //         cout << board[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << "b" << endl;
        bool charl = move(2, 1);
        // cout << tomoe << " " << charl << endl;
        // for (int i = 0; i < 8; i++) {
        //     for (int j = 0; j < 8; j++) {
        //         cout << board[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << "b" << endl;
        if (!tomoe && !charl) {
            break;
        }
    }
    for (int i = 0; i < 8; i++) {
        string ss = "";
        for (int j = 0; j < 8; j++) {
            if (board[i][j] == 1) {
                ss += "o";
            } else if (board[i][j] == 2) {
                ss += "x";
            } else {
                ss += ".";
            }
        }
        cout << ss << endl;
    }
}



Measured memory_bytes: 3224