#include <bits/stdc++.h>
int main() {
  int n, i, j, k, l = 0;
  int a[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}};
  char s[6][8];
  for (i = 0; i < 6; i++) scanf("%s", s[i]);
  for (j = 0; j < 6; j++) {
    for (i = 0; i < 8; i++) {
      if (s[j][i] == '-') continue;
      if (s[j][i] == '.') {
        if (l <= a[j][i]) {
          n = j, k = i;
          l = a[j][i];
        }
      }
    }
  }
  s[n][k] = 'P';
  for (i = 0; i < 6; i++) {
    for (j = 0; j < 8; j++) {
      printf("%c", s[i][j]);
    }
    printf("\n");
  }
}
