#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
template <typename T>
using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T>
using que = queue<T>;
template <typename T>
using deq = deque<T>;
template <typename T>
T id(T b) {
  return b;
};
template <typename T>
void chmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chmin(T &x, T y) {
  if (x > y) x = y;
}
template <typename S, typename K>
bool contains(S &s, K k) {
  return s.find(k) != s.end();
}
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
constexpr ll TEN(int n) {
  if (n == 0)
    return 1LL;
  else
    return 10LL * TEN(n - 1);
}
string state[6];
int main() {
  fastio();
  for (int i = 0; i < int(6); i++) {
    cin >> state[i];
  }
  int mx = 0;
  int pi = -1, pj = -1;
  for (int i = 0; i < int(6); i++) {
    for (int j = 0; j < int(8); j++) {
      if (state[i][j] == '*' || state[i][j] == '-') continue;
      int temp = (j == 3 || j == 4) ? 1 : 0;
      temp += (6 - i + 1) / 2;
      if (mx < temp) {
        pi = i;
        pj = j;
        mx = temp;
      }
    }
  }
  if (pi >= 0 && pj >= 0) {
    state[pi][pj] = 'P';
  }
  for (int i = 0; i < int(6); i++) {
    cout << state[i] << "\n";
  }
  return 0;
}
