#include <bits/stdc++.h>
long long q, a[7][10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 4, 4, 0, 3,
                         3, 0, 0, 3, 3, 0, 4, 4, 0, 3, 3, 0, 0, 2, 2, 0, 3, 3,
                         0, 2, 2, 0, 0, 2, 2, 0, 3, 3, 0, 2, 2, 0, 0, 1, 1, 0,
                         2, 2, 0, 1, 1, 0, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0},
             s, s1, s2;
char b[10][10];
int main() {
  for (int i = 1; i <= 6; i++)
    for (int j = 1; j <= 8; j++) scanf(" %c", &b[i][j]);
  for (int i = 1; i <= 6; i++) {
    for (int j = 1; j <= 8; j++) {
      if (b[i][j] == '.') {
        q = a[i][j];
        if (q >= s) {
          s = q;
          s1 = i;
          s2 = j;
        }
      }
    }
  }
  b[s1][s2] = 'P';
  for (int i = 1; i <= 6; i++) {
    for (int j = 1; j <= 8; j++) printf("%c", b[i][j]);
    printf("\n");
  }
}
