#include <bits/stdc++.h>
enum { LEN_X = 8, LEN_Y = 6 };
int f(int y, int x) {
  int ans = -y / 2;
  if (x == 3 || x == 4) {
    ++ans;
  }
  return ans;
}
int main() {
  char buf[LEN_Y][LEN_X + 1];
  int best_x = 0, best_y = 0;
  int best_f = -100500;
  for (int y = 0; y < LEN_Y; ++y) {
    scanf("%s", buf[y]);
    for (int x = 0; x < LEN_X; ++x) {
      if (buf[y][x] == '.' && f(y, x) > best_f) {
        best_f = f(y, x);
        best_y = y;
        best_x = x;
      }
    }
  }
  buf[best_y][best_x] = 'P';
  for (int y = 0; y < LEN_Y; ++y) {
    printf("%s\n", buf[y]);
  }
}
