#include <bits/stdc++.h>
int mas[6][8] = {{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}};
int main(void) {
  char ss[6][9];
  for (int i = 0; i < 6; ++i) {
    scanf("%s", ss[i]);
  }
  int maxx = 0;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) {
      if (ss[i][j] == '.') {
        if (maxx < mas[i][j]) maxx = mas[i][j];
      }
    }
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 8; ++j) {
      if (ss[i][j] == '.' && mas[i][j] == maxx) {
        ss[i][j] = 'P';
        goto ll;
      }
    }
  }
ll:;
  for (int i = 0; i < 6; ++i) {
    printf("%s\n", ss[i]);
  }
  return 0;
}
