#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[6];
  set<pair<int, pair<int, int> > > best;
  int val[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}};
  for (int i = 0; i < 6; i++) {
    cin >> s[i];
    for (int j = 0; j < 8; j++) {
      if (s[i][j] == '.') {
        best.insert(make_pair(-val[i][j], make_pair(i, j)));
      }
    }
  }
  pair<int, int> pos = (*best.begin()).second;
  s[pos.first][pos.second] = 'P';
  for (int i = 0; i < 6; i++) {
    cout << s[i] << '\n';
  }
  return 0;
}
