#include <bits/stdc++.h>
using namespace std;
int main() {
  char c[6][8];
  int min = 100, x, y;
  for (int i = 0; i < 6; i++) scanf("%s", c[i]);
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 8; j++)
      if (c[i][j] == '.' && 2 * i + abs(2 * j - 7) < min)
        min = 2 * i + abs(2 * j - 7), x = i, y = j;
  c[x][y] = 'P';
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) cout << c[i][j];
    cout << endl;
  }
}
