#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<string> s(6);
  for (int i = 0; i < 6; i++) cin >> s[i];
  vector<vector<int> > v({{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 ii = -1, jj = -1;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (s[i][j] == '.') {
        if (ii == -1 || v[ii][jj] < v[i][j]) {
          ii = i;
          jj = j;
        }
      }
    }
  }
  s[ii][jj] = 'P';
  for (int i = 0; i < 6; i++) cout << s[i] << endl;
  return 0;
}
