#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6;
const long long INF = 1e9 + 1;
const long long BITS = 64;
const long double EPS = 1e-9;
const long long L = 18;
void bye() {
  cout << '\n';
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  vector<string> g(6);
  for (int i = 0; i < 6; i++) {
    cin >> g[i];
  }
  vector<vector<int> > price = {
      {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 ans = 0;
  int x, y;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < (long long)(g[i]).size(); j++) {
      if (g[i][j] == '.') {
        if (price[i][j] > ans) {
          ans = price[i][j];
          x = i;
          y = j;
        }
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < (long long)(g[i]).size(); j++) {
      if (i == x && j == y) {
        cout << "P";
      } else {
        cout << g[i][j];
      }
    }
    cout << "\n";
  }
  bye();
}
