import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    char[][] F;
    foreach (i; 0 .. 8) {
        F ~= cast(char[])readln.chomp;
    }

    const dy = [-1, -1, 0, 1, 1, 1, 0, -1],
          dx = [0, 1, 1, 1, 0, -1, -1, -1];

    bool chocolate() {
        long cy = -1, cx = -1;
        int Ans = 0;
        foreach (i; 0 .. 8) {
            foreach (j; 0 .. 8) {
                if (F[i][j] != '.') continue;
                int A = 0;
                foreach (k; 0 .. 8) {
                    int C = 0;
                    auto y = i, x = j;
                    while (true) {
                        y += dy[k]; x += dx[k];
                        if (y < 0 || y >= 8) break;
                        if (x < 0 || x >= 8) break;
                        if (F[y][x] == '.') break;
                        if (F[y][x] == 'o') {
                            A += C;
                            break;
                        }
                        assert(F[y][x] == 'x');
                        C++;
                    }
                }
                if (A > Ans) {
                    cy = i; cx = j;
                    Ans = A;
                }
            }
        }
        if (Ans == 0) return false;
        F[cy][cx] = 'o';
        foreach (k; 0 .. 8) {
            auto y = cy, x = cx;
            while (true) {
                y += dy[k]; x += dx[k];
                if (y < 0 || y >= 8) break;
                if (x < 0 || x >= 8) break;
                if (F[y][x] == '.') break;
                if (F[y][x] == 'o') {
                    auto y1 = cy, x1 = cx;
                    while (y1 != y || x1 != x) {
                        y1 += dy[k]; x1 += dx[k];
                        F[y1][x1] = 'o';
                    }
                    break;
                }
            }
        }
        return true;
    }

    bool cheese() {
        long cy = -1, cx = -1;
        int Ans = 0;
        foreach (i; 0 .. 8) {
            foreach (j; 0 .. 8) {
                if (F[i][j] != '.') continue;
                int A = 0;
                foreach (k; 0 .. 8) {
                    int C = 0;
                    auto y = i, x = j;
                    while (true) {
                        y += dy[k]; x += dx[k];
                        if (y < 0 || y >= 8) break;
                        if (x < 0 || x >= 8) break;
                        if (F[y][x] == '.') break;
                        if (F[y][x] == 'x') {
                            A += C;
                            break;
                        }
                        assert(F[y][x] == 'o');
                        C++;
                    }
                }
                if (A >= Ans) {
                    cy = i; cx = j;
                    Ans = A;
                }
            }
        }
        if (Ans == 0) return false;
        F[cy][cx] = 'x';
        foreach (k; 0 .. 8) {
            auto y = cy, x = cx;
            while (true) {
                y += dy[k]; x += dx[k];
                if (y < 0 || y >= 8) break;
                if (x < 0 || x >= 8) break;
                if (F[y][x] == '.') break;
                if (F[y][x] == 'x') {
                    auto y1 = cy, x1 = cx;
                    while (y1 != y || x1 != x) {
                        y1 += dy[k]; x1 += dx[k];
                        F[y1][x1] = 'x';
                    }
                    break;
                }
            }
        }
        return true;
    }

    for (int i = 0; ; i++) {
        bool a = chocolate;
        //foreach (L; F) { writeln(L); } writeln;
        bool b = cheese;
        //foreach (L; F) { writeln(L); } writeln;
        if (!a && !b) break;
    }
    foreach (L; F) {
        writeln(L);
    }
}

Measured memory_bytes: 1060