#include <bits/stdc++.h>
using namespace std;
vector<int> s[10];
void answer() {
  long long n, x, ans = 0;
  string s[7];
  n = 4;
  int f = 0, ans1 = 0;
  for (int i = 0; i < 6; i++) cin >> s[i];
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if ((s[i][j] == '.') && (j == 3 || j == 4)) {
        s[i][j] = 'P';
        f = 2;
        break;
      } else if (s[i][j] == '.') {
        f = 1;
        ans = j;
        ans1 = i;
      }
    }
    if (f == 2) {
      break;
    } else if (i % 2 == 1 && f == 1) {
      s[ans1][ans] = 'P';
      break;
    }
  }
  for (int i = 0; i < 6; i++) cout << s[i] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q;
  answer();
  return 0;
}
