extern crate core;

use std::fmt;
use std::cmp::{max, min, Ordering};
use std::collections::{BinaryHeap, BTreeMap};
use std::fmt::{Display, Formatter, Error};
use std::ops::Range;
macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
struct ValueWithKey<K, V> {
    key: K, value: V,
}
impl <K, V> Ord for ValueWithKey<K, V> where K: Ord {
    fn cmp(&self, other: &Self) -> Ordering {
        self.key.cmp(&other.key)
    }
}
impl <K, V> PartialOrd for ValueWithKey<K, V> where K: PartialOrd {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        self.key.partial_cmp(&other.key)
    }
}
impl <K, V> PartialEq for ValueWithKey<K, V> where K: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.key == other.key
    }
}
impl <K, V> Eq for ValueWithKey<K, V> where K: Eq {}
#[derive(Copy, Clone)]
struct Coordinate {
    x: usize, y: usize
}
impl Coordinate {
    fn create(x: i32, y: i32) -> Coordinate {
        Coordinate{x: x as usize, y: y as usize}
    }
}
impl Display for Coordinate {
    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
        write!(f, "(x: {}, y: {})", self.x, self.y)
    }
}
fn find_tomoe(state: &Vec<Vec<char>>) -> Option<Coordinate> {
    let mut max = 0;
    let mut max_coordinate = Coordinate::create(0, 0);
    for y in 0 .. 8 {
        for x in 0 .. 8 {
            let mut count = 0;
            match state[y][x] {
                '.' => {
                    for dx in -1_i32 .. 2 {
                        for dy in -1_i32 .. 2 {
                            if dx != 0 || dy != 0 {
                                let mut temp = 0;
                                let mut cx = x as i32 + dx;
                                let mut cy = y as i32 + dy;
                                while cx >= 0 && cx < 8 && cy >= 0 && cy < 8{
                                    match state[cy as usize][cx as usize] {
                                        'x' => {
                                            temp += 1;
                                            cx += dx;
                                            cy += dy;
                                        }
                                        'o' => {
                                            count += temp;
                                            break
                                        }
                                        '.' => break,
                                        _ => unreachable!()
                                    }
                                }
                            }
                        }
                    }
                }
                _ => {}
            }
            if max < count {
                max = count;
                max_coordinate = Coordinate{x: x, y: y};
            }
        }
    }
    if max == 0 {
        None
    }else {
        Some(max_coordinate)
    }
}
fn find_okashi(state: &Vec<Vec<char>>) -> Option<Coordinate> {
    let mut max = 0;
    let mut max_coordinate = Coordinate::create(0, 0);
    for y in 0 .. 8 {
        for x in 0 .. 8 {
            let mut count = 0;
            match state[7 - y][7 - x] {
                '.' => {
                    for dx in -1_i32..2 {
                        for dy in -1_i32..2 {
                            if dx != 0 || dy != 0 {
                                let mut temp = 0;
                                let mut cx = 7 - x as i32 + dx;
                                let mut cy = 7 - y as i32 + dy;
                                while cx >= 0 && cx < 8 && cy >= 0 && cy < 8 {
                                    match state[cy as usize][cx as usize] {
                                        'o' => {
                                            temp += 1;
                                            cx += dx;
                                            cy += dy;
                                        }
                                        'x' => {
                                            count += temp;
                                            break
                                        }
                                        '.' => break,
                                        _ => unreachable!()
                                    }
                                }
                            }
                        }
                    }
                }
                _ => {}
            }
            if max < count {
                max = count;
                max_coordinate = Coordinate{x: 7 - x, y: 7 - y};
            }
        }
    }
    if max == 0 {
        None
    }else {
        Some(max_coordinate)
    }
}
fn put_tomoe(state: &mut Vec<Vec<char>>, coordinate: Coordinate) {
    state[coordinate.y][coordinate.x] = 'o';
    for dy in -1_i32 .. 2 {
        for dx in -1_i32 .. 2 {
            if dy != 0 || dx != 0 {
                let mut cx = coordinate.x as i32 + dx;
                let mut cy = coordinate.y as i32 + dy;
                while cx >= 0 && cx < 8 && cy >= 0 && cy < 8 {
                    match state[cy as usize][cx as usize] {
                        'o' => {
                            let mut x = (coordinate.x as i32 + dx) as usize;
                            let mut y = (coordinate.y as i32 + dy) as usize;
                            while state[y][x] == 'x' {
                                state[y][x] = 'o';
                                x = (x as i32 + dx) as usize;
                                y = (y as i32 + dy) as usize;
                            }
                            break
                        }
                        'x' => {
                            cx += dx;
                            cy += dy;
                        }
                        '.' => break,
                        _ => unreachable!()
                    }
                }
            }
        }
    }
}
fn put_okashi(state: &mut Vec<Vec<char>>, coordinate: Coordinate) {
    state[coordinate.y][coordinate.x] = 'x';
    for dy in -1_i32 .. 2 {
        for dx in -1_i32 .. 2 {
            if dy != 0 || dx != 0 {
                let mut cx = coordinate.x as i32 + dx;
                let mut cy = coordinate.y as i32 + dy;
                while cx >= 0 && cx < 8 && cy >= 0 && cy < 8 {
                    match state[cy as usize][cx as usize] {
                        'x' => {
                            let mut x = (coordinate.x as i32 + dx) as usize;
                            let mut y = (coordinate.y as i32 + dy) as usize;
                            while state[y][x] == 'o' {
                                state[y][x] = 'x';
                                x = (x as i32 + dx) as usize;
                                y = (y as i32 + dy) as usize;
                            }
                            break
                        }
                        'o' => {
                            cx += dx;
                            cy += dy;
                        }
                        '.' => break,
                        _ => unreachable!()
                    }
                }
            }
        }
    }
}
fn tomoe_turn(state: &mut Vec<Vec<char>>) {
    if let Some(c) = find_tomoe(state) {
        put_tomoe(state, c)
    }
}
fn okashi_turn(state: &mut Vec<Vec<char>>) {
    if let Some(c) = find_okashi(state) {
        put_okashi(state, c)
    }
}
fn main(){
    let mut state = Vec::<Vec<char>>::with_capacity(8);
    for _ in 0 .. 8 {
        state.push(read_line!().chars().collect());
    }
    for i in 0 .. 64 {
        tomoe_turn(&mut state);
        okashi_turn(&mut state);
    }
    for y in 0 .. 8{
        for x in 0 .. 8 {
            print!("{}", state[y][x]);
        }
        println!();
    }
}




Measured memory_bytes: 5028