#include <bits/stdc++.h>
using namespace std;
const unsigned int p[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}};
int main() {
  char c[6][8];
  unsigned int m(0), a, b;
  for (size_t i = 0; i < 6; ++i) {
    for (size_t j = 0; j < 8; ++j) {
      cin >> c[i][j];
      if (c[i][j] != '*' && m < p[i][j]) {
        m = p[i][j];
        a = i;
        b = j;
      }
    }
  }
  for (size_t i = 0; i < 6; ++i) {
    for (size_t j = 0; j < 8; ++j) {
      if (i == a && b == j) {
        cout << "P";
      } else {
        cout << c[i][j];
      }
    }
    cout << endl;
  }
  return 0;
}
