#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 6, m = 8;
  vector<string> a(n);
  vector<vector<int>> u;
  vector<int> loc(m);
  loc = {3, 3, -1, 4, 4, -1, 3, 3};
  u.push_back(loc);
  u.push_back(loc);
  loc = {2, 2, -1, 3, 3, -1, 2, 2};
  u.push_back(loc);
  u.push_back(loc);
  loc = {1, 1, -1, 2, 2, -1, 1, 1};
  u.push_back(loc);
  u.push_back(loc);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int max = 0, x, y;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '.' && u[i][j] > max) {
        x = i;
        y = j;
        max = u[i][j];
      }
    }
  }
  a[x][y] = 'P';
  for (auto i : a) {
    cout << i << "\n";
  }
}
