#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> b(6);
  for (int i = 0; i < 6; i++) cin >> b[i];
  bool check = false;
  for (int i = 0; i < 6; i++)
    for (int j = 3; j < 5; j++)
      if (b[i][j] == '.') {
        b[i][j] = 'P';
        check = true;
        for (int i = 0; i < 6; i++) cout << b[i] << endl;
        return 0;
      }
  if (!check)
    for (int i = 0; i < 6; i++)
      for (int j = 0; j < 8; j++)
        if (b[i][j] == '.') {
          b[i][j] = 'P';
          check = true;
          for (int i = 0; i < 6; i++) cout << b[i] << endl;
          return 0;
        }
  return 0;
}
