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