#include <bits/stdc++.h>
const int maxn = 2e5 + 9;
int score[19][19] = {{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 ch[19][19];
int main() {
  for (int i = 0; i < 6; i++) scanf("%s", ch[i]);
  int mx = 0, ii, jj;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (ch[i][j] == '-' || ch[i][j] == '*') {
        continue;
      }
      if (score[i][j] > mx) mx = score[i][j], ii = i, jj = j;
    }
  }
  ch[ii][jj] = 'P';
  for (int i = 0; i < 6; i++) {
    printf("%s\n", ch[i]);
  }
  return 0;
}
