#include <bits/stdc++.h>
char s[6][8];
int priorY[36] = {0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 2, 2,
                  2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5};
int priorX[36] = {3, 4, 3, 4, 0, 1, 6, 7, 0, 1, 6, 7, 3, 4, 3, 4, 0, 1,
                  6, 7, 0, 1, 6, 7, 3, 4, 3, 4, 0, 1, 6, 7, 0, 1, 6, 7};
int main() {
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      scanf("%c", &s[i][j]);
    }
    scanf("\n");
  }
  int y = 0, x = 0;
  for (int i = 0; i < 36; i++) {
    if (s[priorY[i]][priorX[i]] == '.') {
      y = priorY[i];
      x = priorX[i];
      break;
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (i == y && j == x)
        printf("P");
      else
        printf("%c", s[i][j]);
    }
    printf("\n");
  }
}
