#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v(6);
  bool sit = false;
  for (long long i = 0; i < 6; i += 2) {
    cin >> v[i];
    cin >> v[i + 1];
    if (v[i][3] == '.' && !sit) {
      v[i][3] = 'P';
      sit = true;
      continue;
    }
    if (v[i][4] == '.' && !sit) {
      v[i][4] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][3] == '.' && !sit) {
      v[i + 1][3] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][4] == '.' && !sit) {
      v[i + 1][4] = 'P';
      sit = true;
      continue;
    }
    if (v[i][0] == '.' && !sit) {
      v[i][0] = 'P';
      sit = true;
      continue;
    }
    if (v[i][1] == '.' && !sit) {
      v[i][1] = 'P';
      sit = true;
      continue;
    }
    if (v[i][6] == '.' && !sit) {
      v[i][6] = 'P';
      sit = true;
      continue;
    }
    if (v[i][7] == '.' && !sit) {
      v[i][7] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][0] == '.' && !sit) {
      v[i + 1][0] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][1] == '.' && !sit) {
      v[i + 1][1] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][6] == '.' && !sit) {
      v[i + 1][6] = 'P';
      sit = true;
      continue;
    }
    if (v[i + 1][7] == '.' && !sit) {
      v[i + 1][7] = 'P';
      sit = true;
      continue;
    }
  }
  for (long long i = 0; i < 6; ++i) {
    cout << v[i] << endl;
  }
  return 0;
}
