#include <bits/stdc++.h>
using namespace std;
int convert(int k) {
  if (k < 2)
    return k;
  else if (k < 5)
    return k - 1;
  else
    return k - 2;
}
int main() {
  string s[6];
  int A[6][6] = {3, 3, 4, 4, 3, 3, 3, 3, 4, 4, 3, 3, 2, 2, 3, 3, 2, 2,
                 2, 2, 3, 3, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1};
  for (int i = 0; i < 6; i++) {
    cin >> s[i];
  }
  int best = 0, besti = 0, bestj = 0;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (s[i][j] == '.') {
        if (A[i][convert(j)] > best) {
          best = A[i][convert(j)];
          besti = i;
          bestj = j;
        }
      }
    }
  }
  s[besti][bestj] = 'P';
  for (int i = 0; i < 6; i++) {
    cout << s[i] << endl;
  }
  return 0;
}
