#include <bits/stdc++.h>
const char cl1[6][8] = {{3, 3, -1, 4, 4, -1, 3, 3}, {3, 3, -1, 4, 4, -1, 3, 3},
                        {2, 2, -1, 3, 3, -1, 2, 2}, {2, 2, -1, 3, 3, -1, 2, 2},
                        {1, 1, -1, 2, 2, -1, 1, 1}, {1, 1, -1, 2, 2, -1, 1, 1}};
int main(int argc, char const *argv[]) {
  char cl[6][8];
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) scanf("%c", &cl[i][j]);
    getchar();
  }
  int max = -1, im = -1, jm = -1;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) {
      if (cl[i][j] == '.' && max < cl1[i][j]) {
        max = cl1[i][j];
        im = i;
        jm = j;
      }
    }
  }
  cl[im][jm] = 'P';
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) printf("%c", cl[i][j]);
    putchar('\n');
  }
  return 0;
}
