#include <bits/stdc++.h>
using namespace std;
int main() {
  char field[6][8];
  for (int i = 0; i < 6; i++) {
    cin >> field[i];
  }
  int cost[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 maxV = 0;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (field[i][j] == '.') {
        maxV = max(maxV, cost[i][j]);
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (cost[i][j] == maxV && field[i][j] == '.') {
        field[i][j] = 'P';
        goto exit;
      }
    }
  }
exit:
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      cout << field[i][j];
    }
    cout << endl;
  }
}
