#include <bits/stdc++.h>
using namespace std;
long long rr[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long cc[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long mod = 1e9 + 7;
const long long N = 300050;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long test = 1;
  while (test--) {
    long long n = 6;
    string s[n];
    for (long long i = 0; i < n; i++) {
      cin >> s[i];
    }
    long long ok = 0;
    for (long long i = 0; i < 2; i++) {
      for (long long j = 3; j <= 4; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 0; i < 2; i++) {
      for (long long j = 0; j < 2; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 0; i < 2; i++) {
      for (long long j = 6; j < 8; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 2; i < 4; i++) {
      for (long long j = 3; j <= 4; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 2; i < 4; i++) {
      for (long long j = 0; j < 2; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 2; i < 4; i++) {
      for (long long j = 6; j < 8; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 4; i < 6; i++) {
      for (long long j = 3; j <= 4; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 4; i < 6; i++) {
      for (long long j = 0; j < 2; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 4; i < 6; i++) {
      for (long long j = 6; j < 8; j++) {
        if (!ok && s[i][j] == '.') {
          ok = 1;
          s[i][j] = 'P';
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      cout << s[i] << '\n';
    }
  }
  return 0;
}
