#include <bits/stdc++.h>
int main() {
  int sc[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},
  };
  char cs[6][10];
  for (int i = 0; i < 6; ++i) {
    scanf("%s", cs[i]);
  }
  int bst = 0;
  int ri, rj;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) {
      if (cs[i][j] == '.' && sc[i][j] > bst) {
        bst = sc[i][j];
        ri = i;
        rj = j;
      }
    }
  }
  cs[ri][rj] = 'P';
  for (int i = 0; i < 6; ++i) {
    printf("%s\n", cs[i]);
  }
  return 0;
}
