#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int arr[3][3] = {{3, 4, 3}, {2, 3, 2}, {1, 2, 1}};
  string s[6];
  for (int i = 0; i < 6; i++) cin >> s[i];
  int best = 0;
  pair<int, int> b;
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 8; j++)
      if (j != 2 && j != 5) {
        if (s[i][j] == '*') continue;
        int c = j;
        if (j >= 3) c--;
        if (j >= 6) c--;
        if (arr[i / 2][c / 2] > best) {
          best = arr[i / 2][c / 2];
          b = make_pair(i, j);
        }
      }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (b == make_pair(i, j))
        cout << "P";
      else
        cout << s[i][j];
    }
    cout << "\n";
  }
}
