#include <bits/stdc++.h>
using namespace std;
int main() {
  int cst[10][10] = {{3, 3, 4, 4, 3, 3}, {3, 3, 4, 4, 3, 3},
                     {2, 2, 3, 3, 2, 2}, {2, 2, 3, 3, 2, 2},
                     {1, 1, 2, 2, 1, 1}, {1, 1, 2, 2, 1, 1}};
  vector<string> v;
  int mx = 0;
  int x, y;
  for (int i = 0; i < 6; i++) {
    string s;
    cin >> s;
    v.push_back(s);
    int it = 0;
    for (int j = 0; j < 6; j++, it++) {
      if (j == 2 || j == 4) it++;
      cerr << s[it] << ' ';
      if (s[it] == '*') continue;
      if (cst[i][j] > mx) {
        mx = cst[i][j];
        x = i;
        y = it;
      }
    }
    cerr << '\n';
  }
  for (int i = 0; i < 6; i++) {
    if (x == i) v[i][y] = 'P';
    cout << v[i] << '\n';
  }
  return 0;
}
