#include <bits/stdc++.h>
int main(void) {
  char a[6][6];
  char p;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      scanf("%c", &a[i][j]);
      if (j == 1 || j == 3 || j == 5) {
        p = getchar();
      }
    }
  }
  int b[6][6];
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 2; ++j) {
      b[i][j] = 3 - i / 2;
    }
    for (int j = 4; j < 6; ++j) {
      b[i][j] = 3 - i / 2;
    }
    for (int j = 2; j < 4; ++j) {
      b[i][j] = 4 - i / 2;
    }
  }
  int err = 0;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      if (b[i][j] == 4 && err == 0 && a[i][j] == '.') {
        a[i][j] = 'P';
        ++err;
      }
    }
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      if (b[i][j] == 3 && err == 0 && a[i][j] == '.') {
        a[i][j] = 'P';
        ++err;
      }
    }
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      if (b[i][j] == 2 && err == 0 && a[i][j] == '.') {
        a[i][j] = 'P';
        ++err;
      }
    }
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      if (b[i][j] == 1 && err == 0 && a[i][j] == '.') {
        a[i][j] = 'P';
        ++err;
      }
    }
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      printf("%c", a[i][j]);
      if (j == 1 || j == 3) {
        printf("-");
      }
    }
    printf("\n");
  }
}
