#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)x)<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define EREP(i,a,b) for(int i=a;i<=b;i++)
#define erep(i,n) EREP(i,0,n)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

int di[] = {-1,-1,-1,0,0,1,1,1};
int dj[] = {-1,0,1,-1,1,-1,0,1};

void copyArray(char to[10][10],char from[10][10]){
  rep(i,10){
    rep(j,10){
      to[i][j] = from[i][j];
    }
  }
}

int count(char t[10][10],char ch){
  int res = 0;
  rep(i,8){
    rep(j,8){
      if(t[i][j] == ch){
        res++;
      }
    }
  }
  return res;
}

void draw(char t[10][10],char ch,int si,int sj){
  t[si][sj] = ch;

  rep(k,8){
    int i = si;
    int j = sj;
    bool drawFlg = false;

    while(1){
      int ni = i + di[k];
      int nj = j + dj[k];
      if(ni < 0 || 8 <= ni || nj < 0 || 8 <= nj || t[ni][nj] == '.'){
        break;
      }
      if(t[ni][nj] == ch){
        if(i != si || j != sj) drawFlg = true;
        break;
      }

      i = ni;
      j = nj;
    }

    if(!drawFlg) continue;

    i = si;
    j = sj;
    while(1){
      int ni = i + di[k];
      int nj = j + dj[k];
      if(t[ni][nj] == ch){
        drawFlg = true;
        break;
      }
      t[ni][nj] = ch;
      i = ni;
      j = nj;
    }
  }
}

int main(void){
  char t[10][10],s[10][10];

  while(1){
    rep(i,8){
      if(scanf("%s",t[i]) == EOF) return 0;
    }

    char now = 'o';
    bool prePass = false;

    while(1){
      int batu = count(t,'x');
      if(batu == 0) break;
      int maru = count(t,'o');
      if(maru == 0) break;

      int maxCnt = (now == 'x' ? batu : maru) + 1;
      int mi=-1,mj=-1;

      if(now == 'o'){
        for(int i=0;i<8;i++){
          for(int j=0;j<8;j++){
            if(t[i][j] != '.') continue;
            copyArray(s,t);
            draw(s,now,i,j);
            int tmp = count(s,now);
            if(maxCnt < tmp){
              maxCnt = tmp;
              mi = i;
              mj = j;
            }
          }
        }
      }
      else{
        for(int i=7;i>=0;i--){
          for(int j=7;j>=0;j--){
            if(t[i][j] != '.') continue;
            copyArray(s,t);
            draw(s,now,i,j);
            int tmp = count(s,now);
            if(maxCnt < tmp){
              maxCnt = tmp;
              mi = i;
              mj = j;
            }
          }
        }
      }

      bool pass = false;

      if(mi != -1){
        draw(t,now,mi,mj);
      }
      else{
        pass = true;
        if(prePass && pass) break;
      }

      prePass = pass;
      now = (now == 'x' ? 'o' : 'x');
    }

    rep(i,8){
      printf("%s\n",t[i]);
    }
  }
}

Measured memory_bytes: 0