// Dessert Witch
// 右横にひっくり返せぬ

#include <iostream>
#include <cstring>

using namespace std;

int s[8][8];

int endJudge() {
  int maru = 0, batu = 0, notYet = 0;
  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      if(s[i][j] == -1)
	maru++;
      else if(s[i][j] == 1)
	batu++;
      else
	notYet++;
    }
  }

  if(maru==0 || batu==0 || notYet==0)
    return 1;
  else
    return 0;
}

int calcMass(int currentX, int currentY, int mode) {
  int tmp = 0;
  int score = 0;
  bool flag=true;

  for(int k=1; k<8/* && flag==true*/; k++) { // 左上へ探索
    if(0<=currentX-k && 0<=currentY-k) {
      if(s[currentX-k][currentY-k] == -mode)
	tmp++;
      else if(s[currentX-k][currentY-k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8/* && flag==true*/; k++) { // 上へ探索
    if(0<=currentY-k) {
      if(s[currentX][currentY-k] == -mode)
	tmp++;
      else if(s[currentX][currentY-k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8/* && flag==true*/; k++) { // 右上へ探索
    if(0<=currentY-k && currentX+k<8) {
      if(s[currentX+k][currentY-k] == -mode)
	tmp++;
      else if(s[currentX+k][currentY-k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8; k++) { // 左横へ検索
    if(0<=currentX-k) {
      if(s[currentX-k][currentY] == -mode)
	tmp++;
      else if(s[currentX-k][currentY] == mode) {
	score+=tmp;
	break;
     }
      else
	break;
    }
    else
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8; k++) { // 右横へ検索
    if(currentX+k < 8) {
      if(s[currentX+k][currentY] == -mode)
	tmp++;
      else if(s[currentX+k][currentY] == mode) {
	score+=tmp;
	break;
      }
      else
	break;
    }
    else
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8/* && flag==true*/; k++) { // 左下へ検索
    if(0<=currentX-k && currentY+k<8) {
      if(s[currentX-k][currentY+k] == -mode)
	tmp++;
      else if(s[currentX-k][currentY+k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8/* && flag==true*/; k++) { // 下へ検索
    if(currentY+k<8) {
      if(s[currentX][currentY+k] == -mode)
	tmp++;
      else if(s[currentX][currentY+k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }

  tmp=0;
  flag=true;
  for(int k=1; k<8/* && flag==true*/; k++) { // 右下へ検
    if(currentX+k<8 && currentY+k<8) {
      if(s[currentX+k][currentY+k] == -mode)
	tmp++;
      else if(s[currentX+k][currentY+k] == mode) {
	score+=tmp;
	break;
      }
      else
	//flag=false;
	break;
    }
    else
      //flag=false;
      break;
  }
  return score;
}



void setOsero(int x, int y, int mode) {
  int currentX = x, currentY = y;
  int tmp;
  s[x][y] = mode;

  tmp=0;
  for(int k=1; k<8; k++) { // 左上へ探索
    if(0<=currentX-k && 0<=currentY-k) {
      if(s[currentX-k][currentY-k] == -mode)
	tmp++;
      else if(s[currentX-k][currentY-k] == mode) {
	for(int l=1; l<tmp+1; l++) {
	  s[currentX-l][currentY-l] *= -1;
	}
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 上へ探索
    if(0<=currentY-k) {
      if(s[currentX][currentY-k] == -mode)
	tmp++;
      else if(s[currentX][currentY-k] == mode) {
	for(int l=1; l<tmp+1; l++) {
	  s[currentX][currentY-l] *= -1;
	}
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 右上へ探索
    if(0<=currentY-k && currentX+k<8) {
      if(s[currentX+k][currentY-k] == -mode)
	tmp++;
      else if(s[currentX+k][currentY-k] == mode) {
	for(int l=1; l<tmp+1; l++) {
	  s[currentX+l][currentY-l] *= -1;
	}
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 左横へ検索
    if(0<=currentX-k) {
      if(s[currentX-k][currentY] == -mode)
	tmp++;
      else if(s[currentX-k][currentY] == mode) {
	for(int l=1; l<tmp+1; l++)
	  s[currentX-l][currentY] *= -1;
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 右横へ検索
    if(0<=currentX+k) {
      if(s[currentX+k][currentY] == -mode)
	tmp++;
      else if(s[currentX+k][currentY] == mode) {
	for(int l=1; l<tmp+1; l++)
	  s[currentX+l][currentY] *= -1;
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 左下へ検索
    if(0<=currentX-k && currentY+k<8) {
      if(s[currentX-k][currentY+k] == -mode)
	tmp++;
      else if(s[currentX-k][currentY+k] == mode) {
	for(int l=1; l<tmp+1; l++)
	  s[currentX-l][currentY+l] *= -1;
        break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 下へ検索
    if(currentY+k<8) {
      if(s[currentX][currentY+k] == -mode)
	tmp++;
      else if(s[currentX][currentY+k] == mode) {
	for(int l=1; l<tmp+1; l++)
	  s[currentX][currentY+l] *= -1;
	break;
      }
      else
	break;
    }
    else
      break;
  }
  tmp=0;
  for(int k=1; k<8; k++) { // 右下へ検
    if(currentX+k<8 && currentY+k<8) {
      if(s[currentX+k][currentY+k] == -mode)
	tmp++;
      else if(s[currentX+k][currentY+k] == mode) {
	for(int l=1; l<tmp+1; l++)
	  s[currentX+l][currentY+l] *= -1;
	break;
      }
      else
	break;
    }
    else
      break;
  }
}

void drawOsero() {
  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      if(s[i][j] == -1)
	cout<<"o";
      else if(s[i][j] == 1)
	cout<<"x";
      else
	cout<<".";
    }
    cout<<endl;
  }
}

int main() {
  //int s[8][8]; // o:-1 x:1 .:0
  //int test=0;

  for(int i=0; i<8; i++) {
    // Input
    string tmp;
    getline(cin, tmp);
    for(int j=0; j<8; j++) {
      if(tmp[j] == 'o') 
	s[i][j] = -1;
      else if(tmp[j] == 'x')
	s[i][j] = 1;
      else
	s[i][j] = 0;
    }
  }
  //drawOsero();

  while(true) {
    int setI, setJ;
    int tmp;
    int maxTmp=0;
    int outo;

    outo=0;
    // いくつ置けるのかを計算
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(s[i][j] == 0) { // 空きマスである
	  int tmp=calcMass(i, j, -1);
	  if(tmp>maxTmp) {
	    maxTmp = tmp;
	    setI = i;
	    setJ = j;
	  }
	}
      }
    }
    // 先行が置く
    if(maxTmp != 0)
      setOsero(setI, setJ, -1);
    else
      outo++;
    //cout<<"S:"<<maxTmp<<endl;
    //drawOsero();



   maxTmp=0;
   for(int i=7; i>=0; i--) {
      for(int j=7; j>=0; j--) {
	if(s[i][j] == 0) { // 空きマスである
	  int tmp=calcMass(i, j, 1);
	  if(tmp>maxTmp) {
	    maxTmp = tmp;
	    setI = i;
	    setJ = j;
	  }
	}
      }
    }
    // 後攻が置く
   if(maxTmp != 0) 
     setOsero(setI, setJ, 1);
   else
     outo++;
   //cout<<"A:"<<maxTmp<<endl;
   //drawOsero();

   if(endJudge()==1 || outo==2)
     break;
   //cout<<endl;
  }
  drawOsero();
}

Measured memory_bytes: 1176