#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& i : v) is >> i;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
  for (auto& i : v) os << i << '\n';
  return os;
}
void solve() {
  int64_t n;
  n = 6;
  vector<string> a(n);
  cin >> a;
  int maxi = 0;
  int imax = 0;
  int jmax = 0;
  vector<vector<int>> v(n, vector<int>(8, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      if (j == 2 || j == 5) continue;
      v[i][j] = (3 - i / 2) + ((j - 1) / 2 == 1);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      if (a[i][j] == '-') continue;
      if (a[i][j] == '.') {
        if (v[i][j] > maxi) {
          maxi = v[i][j];
          imax = i;
          jmax = j;
        }
      }
    }
  }
  a[imax][jmax] = 'P';
  cout << a;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
