// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

// #undef DEBUG
// #define DEBUG
// DEBUG {{{
#include <array>
#include <deque>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <tuple>
#include <valarray>
#include <vector>
template < int n, class... T >
typename std::enable_if< (n >= sizeof...(T)) >::type __output_tuple(
    std::ostream &, std::tuple< T... > const &) {}
template < int n, class... T >
typename std::enable_if< (n < sizeof...(T)) >::type __output_tuple(
    std::ostream &os, std::tuple< T... > const &t) {
  os << (n == 0 ? "" : ", ") << std::get< n >(t);
  __output_tuple< n + 1 >(os, t);
}
template < class... T >
std::ostream &operator<<(std::ostream &os, std::tuple< T... > const &t) {
  os << "(";
  __output_tuple< 0 >(os, t);
  os << ")";
  return os;
}
template < class T, class U >
std::ostream &operator<<(std::ostream &os, std::pair< T, U > const &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template < class T >
std::ostream &operator<<(std::ostream &os, const std::stack< T > &a) {
  os << "{";
  for(auto tmp = a; tmp.size(); tmp.pop())
    os << (a.size() == tmp.size() ? "" : ", ") << tmp.top();
  os << "}";
  return os;
}
template < class T, class Container, class Compare >
std::ostream &operator<<(std::ostream &os,
    std::priority_queue< T, Container, Compare > a) {
  os << "{ (top) ";
  while(a.size()) os << a.top() << (a.size() == 1 ? "" : ", "), a.pop();
  os << " }";
  return os;
}
template < class T, class Container >
std::ostream &operator<<(std::ostream &os, std::queue< T, Container > a) {
  os << "{ ";
  while(a.size()) os << a.front() << (a.size() == 1 ? "" : ", "), a.pop();
  os << " }";
  return os;
}
#ifdef DEBUG
#if !defined(DEBUG_OUT)
#define DEBUG_OUT std::cerr
#endif
#define dump(...)                                                                \
  [&]() {                                                                        \
    auto __debug_tap = std::make_tuple(__VA_ARGS__);                             \
    DEBUG_OUT << "[" << __LINE__ << "] " << #__VA_ARGS__ << " = " << __debug_tap \
    << std::endl;                                                      \
  }()
template < class T >
inline void dump2D(T &d, size_t sizey, size_t sizex) {
  for(size_t i = 0; i < sizey; i++) {
    DEBUG_OUT << "\t";
    for(size_t j = 0; j < sizex; j++)
      DEBUG_OUT << d[i][j] << (j + 1 == sizex ? "" : "\t");
    DEBUG_OUT << std::endl;
  }
}
template < class T >
inline void dump1D(T &d, size_t sizey) {
  for(size_t i = 0; i < sizey; i++) {
    DEBUG_OUT << d[i] << (i + 1 == sizey ? "" : " ");
  }
  DEBUG_OUT << std::endl;
}
template <
class T, class = typename std::iterator_traits< decltype(begin(T())) >::value_type,
      class = typename std::enable_if< !std::is_same< T, std::string >::value >::type >
      std::ostream &operator<<(std::ostream &os, const T &a) {
        os << "{";
        for(auto ite = begin(a); ite != end(a); ++ite)
          os << (ite == begin(a) ? "" : ", ") << *ite;
        os << "}";
        return os;
      }
#else
#define dump(...) ((void) 42)
#define dump2D(...) ((void) 42)
#define dump1D(...) ((void) 42)
template <
class T, class = typename std::iterator_traits< decltype(begin(T())) >::value_type,
      class = typename std::enable_if< !std::is_same< T, std::string >::value >::type >
      std::ostream &operator<<(std::ostream &os, const T &a) {
        for(auto ite = begin(a); ite != end(a); ++ite)
          os << (ite == begin(a) ? "" : " ") << *ite;
        return os;
      }
#endif
// }}}

char minimize = 'o'; // second

string s[8];
int dx[] = {1, 0, 1, 1, -1, 0, -1, -1};
int dy[] = {0, 1, 1, -1, 0, -1, -1, 1};
char blank = '.';

bool is_inside(int y, int x, int h, int w) { return 0 <= y && 0 <= x && y < h && x < w; }

using Cordinate = tuple<int, int>;

int num(char me, char you, int y, int x, int sy, int sx, vector<Cordinate> & cords) {
  assert(s[y][x] == blank);
  int res = 0;
  vector<Cordinate> nc;
  while(1) {
    y += sy;
    x += sx;
    if(!is_inside(y, x, 8, 8)) return 0;
    if(s[y][x] == blank) return 0;
    if(s[y][x] == you) res++, nc.emplace_back(y, x);
    if(s[y][x] == me) break;
  }
  for(auto el : nc) cords.push_back(el);
  return res;
}

bool check(char me, char you) {
  tuple<int, int, int, vector<Cordinate>> ans(0, 8, 8, vector<Cordinate>());

  for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++) {
    if(s[i][j] != blank) continue;
    vector<Cordinate> cords;
    int sum = 0;
    for(int d = 0; d < 8; d++) {
      sum += num(me, you, i, j, dy[d], dx[d], cords);
    }
    ans = max(ans, make_tuple(
          sum,
          me == minimize ? -i : i,
          me == minimize ? -j : j,
          cords
          )
        );
  }

  if(me == minimize && get<1>(ans) != 8) get<1>(ans) *= -1, get<2>(ans) *= -1;

  for(auto p : get<3>(ans)) {
    s[get<0>(p)][get<1>(p)] = me;
  }
  // dump(get<1>(ans), get<2>(ans));
  bool passed = get<1>(ans) == 8;
  if(!passed) s[get<1>(ans)][get<2>(ans)] = me;
  return passed;
}


int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  for(int i = 0; i < 8; i++) cin >> s[i];

  char me = 'o', you = 'x';

  int pass = 0;
  while(1) {
    // dump(me);
    auto p = check(me, you);
    if(p) pass++;
    else pass = 0;
    if(pass == 2) break;
    swap(me, you);
    // for(int i = 0; i < 8; i++) cout << s[i] << "\n";
  }

  for(int i = 0; i < 8; i++) cout << s[i] << "\n";

  return 0;
}



Measured memory_bytes: 3248