#include <bits/stdc++.h>
using namespace std;

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

#define NROW 8
#define NCOL 8

#define PLAYERA 0
#define PLAYERB 1

#define STONEA 'o'
#define STONEB 'x'
#define STONEEMPTY '.'

struct Point {
    int r;
    int c;
};

char board[NROW][NCOL];

void change_player(int *turn) {
    if(*turn == PLAYERA) {
        *turn = PLAYERB;
    } else {
        *turn = PLAYERA;
    }
}

int count_placed_stones() {
    int cnt = 0;
    REP(i, NROW) REP(j, NCOL) if(board[i][j] != STONEEMPTY) cnt++;
    return cnt;
}

bool in_board(Point p) {
    if (p.r < 0 || NROW <= p.r || p.c < 0 || NCOL <= p.c) {
        return false;
    } else {
        return true;
    }
}

int simulate_placement(int turn, Point p, bool execute) {
    int replace_cnt = 0;
    char my_stone, opponent_stone;
    my_stone = (turn == PLAYERA) ? STONEA : STONEB;
    opponent_stone = (turn == PLAYERA) ? STONEB : STONEA;
    Point tp;
    bool ok;
    if(board[p.r][p.c] != STONEEMPTY) return 0;
    REP(dir, 8) {
        tp.r = p.r; tp.c = p.c;
        ok = true;
        while(true) {
            tp.r += dx[dir]; tp.c += dy[dir];
            if(!in_board(tp)){
                ok = false; break;
            }
            if(board[tp.r][tp.c] == opponent_stone){
                continue;
            } else if (board[tp.r][tp.c] == my_stone) {
                break;
            } else {
                ok = false; break;
            }
        }
        if(!ok) continue;
        while(true) {
            tp.r -= dx[dir]; tp.c -= dy[dir];
            if (tp.r == p.r && tp.c == p.c) break;
            if(execute) board[tp.r][tp.c] = my_stone;
            replace_cnt++;
        }
    }
    if(execute) board[p.r][p.c] = my_stone;
    return replace_cnt;
}

bool play_turn(int turn) {
    bool placed_stone = false;
    int best_replace_cnt = 0;
    int cur_replace_cnt;
    Point bestp = {-1, -1};
    Point curp = {-1, -1};
    REP(r, NROW) REP(c, NCOL) {
        if(turn == PLAYERA) {
            curp.r = r; curp.c = c;
        } else {
            curp.r = NROW - r - 1; curp.c = NCOL - c - 1;
        }
        cur_replace_cnt = simulate_placement(turn, curp, false);
        if (cur_replace_cnt > best_replace_cnt) {
            best_replace_cnt = cur_replace_cnt;
            bestp.r = curp.r; bestp.c = curp.c;
        }
    }
    if(bestp.r != -1 && bestp.c != -1) {
        simulate_placement(turn, bestp, true);
        placed_stone = true;
    }
    return placed_stone;
}

void print_board() {
    REP(r, NROW) {
        REP(c, NCOL) {
            cout << board[r][c];
        }
        cout << endl;
    }
}

void solve() {
    int turn = PLAYERA;
    int continuous_skip_cnt = 0;
    while(count_placed_stones() < NROW*NCOL) {
        bool placed_stone = play_turn(turn);
        if(placed_stone) {
            continuous_skip_cnt = 0;
        } else {
            continuous_skip_cnt++;
            if (continuous_skip_cnt >= 2) break;
        }
        change_player(&turn);
    }
    print_board();
}

signed main() {
    REP(i, NROW) {
        string rowstr; cin >> rowstr;
        REP(j, NCOL) board[i][j] = rowstr[j];
    }

    solve();
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々


Measured memory_bytes: 3232