#include <bits/stdc++.h>
int max(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int cm(const void *A, const void *B) { return *(int *)A - *(int *)B; }
const int MAX = 1e5;
int main() {
  int const row = 6, col = 8;
  int j, i, P = 1;
  int sum, n;
  char a[row + 2][col];
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) {
      char c = getchar();
      if (j > 1 && j < 6)
        a[i][j] = c;
      else
        a[i + 2][j] = c;
    }
    getchar();
  }
  for (i = 0; i < row + 2; i++)
    for (j = 0; j < col && P; j++)
      if (a[i][j] == '.') {
        a[i][j] = 'P';
        P = 0;
      }
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) {
      if (j < 2 || j > 5)
        putchar(a[i + 2][j]);
      else
        putchar(a[i][j]);
    }
    printf("\n");
  }
  return 0;
}
