#include <bits/stdc++.h>
using namespace std;
bool compare(pair<long long, pair<long long, long long> >& a,
             pair<long long, pair<long long, long long> >& b) {
  return a.first > b.first;
}
signed main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  char matrix[10][10];
  vector<long long> vec[10];
  vec[1] = {-1, 3, 3, -1, 4, 4, -1, 3, 3};
  vec[2] = {-1, 3, 3, -1, 4, 4, -1, 3, 3};
  vec[3] = {-1, 2, 2, -1, 3, 3, -1, 2, 2};
  vec[4] = {-1, 2, 2, -1, 3, 3, -1, 2, 2};
  vec[5] = {-1, 1, 1, -1, 2, 2, -1, 1, 1};
  vec[6] = {-1, 1, 1, -1, 2, 2, -1, 1, 1};
  for (long long i = 1; i <= 6; i++) {
    for (long long j = 1; j <= 8; j++) {
      cin >> matrix[i][j];
    }
  }
  vector<pair<long long, pair<long long, long long> > > pai;
  for (long long i = 1; i <= 6; i++) {
    for (long long j = 1; j <= 8; j++) {
      if (matrix[i][j] == '.') {
        long long pp = vec[i][j];
        pai.push_back({pp, {i, j}});
      }
    }
  }
  sort(pai.begin(), pai.end(), compare);
  long long x = pai[0].second.first, y = pai[0].second.second;
  for (long long i = 1; i <= 6; i++) {
    for (long long j = 1; j <= 8; j++) {
      if (i == x && j == y) {
        matrix[i][j] = 'P';
      }
      cout << matrix[i][j];
    }
    cout << "\n";
  }
}
