#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

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

namespace { // stringify

template<typename T>
__attribute__((unused))
void stringify_helper(std::ostringstream &oss, T const &x) {
  oss << std::to_string(x);
}

template<>
__attribute__((unused))
void stringify_helper(std::ostringstream &oss, std::string const &s) {
  oss << "\"" << s << "\"";
}

template<typename T, typename U>
__attribute__((unused))
void stringify_helper(std::ostringstream &oss, std::pair<T, U> const &p) {
  oss << "(";
  stringify_helper(oss, p.first);
  oss << ", ";
  stringify_helper(oss, p.second);
  oss << ")";
}

template<template<typename... Args> class Temp, typename... Args>
__attribute__((unused))
void stringify_helper(std::ostringstream &oss, Temp<Args...> const &v) {
  bool b = false;
  oss << "{";
  for (auto &&x : v) {
    if (b) { oss << ", "; }
    stringify_helper(oss, x);
    b = true;
  }
  oss << "}";
}

template<typename Head, typename... Tail>
__attribute__((unused))
std::string stringify(Head const &head, Tail const &...tail) {
  std::ostringstream oss;
  if (sizeof...(tail) > 0) { oss << "["; }
  stringify_helper(oss, head);
  int const arr[] = { (oss << ", ", stringify_helper(oss, tail), 0)... };
  (void)arr;
  if (sizeof...(tail) > 0) { oss << "]"; }
  return oss.str();
}

} // namespace

using namespace std;

using Board = vector<string>;
int constexpr size = 8;

bool is_inboard(int i, int j) {
  return 0 <= i && i < size && 0 <= j && j < size;
}

bool avaiable(Board const &board, int i, int j, char me, char she) {
  REP(dir, 8) {
    int cookie_cnt = 0;
    int x = i + dx[dir], y = j + dy[dir];
    while (is_inboard(x, y) && board[x][y] == she) {
      x += dx[dir], y += dy[dir];
      ++cookie_cnt;
    }
    if (is_inboard(x, y) && board[x][y] == me && cookie_cnt > 0) {
      return true;
    }
  }
  return false;
}

tuple<int, Board> make_move(Board const &init, int i, int j, char me, char she) {
  Board board = init;
  board[i][j] = me;
  int cnt = 1;
  REP(dir, 8) {
    int x = i + dx[dir], y = j + dy[dir];
    while (is_inboard(x, y) && board[x][y] == she) {
      x += dx[dir], y += dy[dir];
    }
    if (!is_inboard(x, y) || board[x][y] != me) { continue; }
    for (x -= dx[dir], y -= dy[dir]; board[x][y] == she; x -= dx[dir], y -= dy[dir]) {
      board[x][y] = me;
      ++cnt;
    }
  }
  return make_tuple(cnt, board);
}

vector<tuple<int, int, int, Board>>
available_moves(Board const &board, char me, char she) {
  vector<tuple<int,int,int,Board>> ret= { make_tuple(-1, -1, -1, board) };
  REP(i, size) REP(j, size) {
    if (board[i][j] == '.' && avaiable(board, i, j, me, she)) {
      Board result; int cnt;
      tie(cnt, result) = make_move(board, i, j, me, she);
      ret.emplace_back(cnt, i, j, result);
    }
  }
  return ret;
}

void solve(Board const &init) {
  char me = 'o', she = 'x';
  Board board = init;
  for (int num = 0; num < 64; ++num, swap(me, she)) {
    auto avm = available_moves(board, me, she);
    sort(avm.begin(), avm.end(),
        [me](auto t1, auto t2) {
          if (get<0>(t1) != get<0>(t2)) {
            return get<0>(t1) > get<0>(t2);
          }
          if (me == 'o') {
            return make_pair(get<1>(t1), get<2>(t1)) < make_pair(get<1>(t2), get<2>(t2));
          } else {
            return make_pair(get<1>(t1), get<2>(t1)) > make_pair(get<1>(t2), get<2>(t2));
          }
        });
    board = get<3>(avm[0]);

    /*
    cerr << num << ":\n";
    for (auto &&row : board) {
      cerr << row << "\n";
    }
    cerr << "\n";
    */
  }
  for (auto &&row : board) {
    cout << row << "\n";
  }
}

int main() {
  // cout << fixed << setprecision(10);

  Board board;
  REP(i, 8) {
    string row; cin >> row;
    board.push_back(row);
  }
  solve(board);
  return 0;
}



Measured memory_bytes: 3240