#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  const int arr[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}};
  char room[7][9];
  int val = -1, x = 0, y = 0;
  for (int i = 0; i < 6; i++) {
    cin >> room[i];
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (room[i][j] == '.' && arr[i][j] > val) {
        val = arr[i][j];
        x = i;
        y = j;
      }
    }
  }
  room[x][y] = 'P';
  for (int i = 0; i < 6; i++) {
    cout << room[i] << "\n";
  }
}
