#include <bits/stdc++.h>
int w[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 st[100][100];
int main() {
  for (int i = 0; i < 6; ++i) scanf("%s", st[i]);
  int ans = 0, x = 0, y = 0;
  for (int i = 0; i < 6; ++i)
    for (int j = 0, num = 0; j < strlen(st[i]); ++j) {
      if (st[i][j] == '.' || st[i][j] == '*') num++;
      if (st[i][j] == '.')
        if (ans < w[i][num - 1]) {
          ans = w[i][num - 1];
          x = i, y = j;
        }
    }
  st[x][y] = 'P';
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < strlen(st[i]); ++j) putchar(st[i][j]);
    putchar('\n');
  }
  return 0;
}
