#include <bits/stdc++.h>
int a[6][6] = {{3, 3, 4, 4, 3, 3}, {3, 3, 4, 4, 3, 3}, {2, 2, 3, 3, 2, 2},
               {2, 2, 3, 3, 2, 2}, {1, 1, 2, 2, 1, 1}, {1, 1, 2, 2, 1, 1}};
char ch[6][8];
int fl = 0;
int ans = 0;
int cur = 0;
char tmp;
int main() {
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) scanf("%c", &ch[i][j]);
    scanf("%c", &tmp);
  }
  for (int i = 0; i < 6; i++) {
    cur = 0;
    for (int j = 0; j < 8; j++) {
      if (j > 2) cur = 1;
      if (j > 5) cur = 2;
      if (a[i][j - cur] > ans && ch[i][j] == '.') ans = a[i][j - cur];
    }
  }
  for (int i = 0; i < 6; i++) {
    cur = 0;
    for (int j = 0; j < 8; j++) {
      if (j > 2) cur = 1;
      if (j > 5) cur = 2;
      if (ch[i][j] == '.' && a[i][j - cur] == ans) {
        ch[i][j] = 'P';
        fl = 1;
      }
      if (fl) break;
    }
    if (fl) break;
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) printf("%c", ch[i][j]);
    printf("\n");
  }
  return 0;
}
