#include <bits/stdc++.h>
const int t[6][8] = {{3, 3, 0, 4, 4, 0, 3, 3}, {3, 3, 0, 4, 4, 0, 3, 3},
                     {2, 2, 0, 3, 3, 0, 2, 2}, {2, 2, 0, 3, 3, 0, 2, 2},
                     {1, 1, 0, 2, 2, 0, 1, 1}, {1, 1, 0, 2, 2, 0, 1, 1}};
int main() {
  char c[7][9];
  for (int i = 0; i < 6; i++) {
    scanf("%s", c + i);
  }
  int maxc = 0, maxI, maxJ;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (c[i][j] == '.') {
        if (maxc < t[i][j]) {
          maxc = t[i][j];
          maxI = i;
          maxJ = j;
        }
      }
    }
  }
  c[maxI][maxJ] = 'P';
  for (int i = 0; i < 6; i++) {
    printf("%s\n", c[i]);
  }
}
