#include <bits/stdc++.h>
using namespace std;
struct place {
  int i, j;
};
int arr[6][8] = {{3, 3, -1, 4, 4, -1, 3, 3}, {3, 3, -1, 4, 4, -1, 3, 3},
                 {2, 2, -1, 3, 3, -1, 2, 2}, {2, 2, -1, 3, 3, -1, 2, 2},
                 {1, 1, -1, 2, 2, -1, 1, 1}, {1, 1, -1, 2, 2, -1, 1, 1}};
int cmp(place a, place b) { return arr[a.i][a.j] < arr[b.i][b.j]; }
int main() {
  int count = 0, str = 0;
  place dot[36];
  string *school;
  school = new string[6];
  for (int i = 0; i < 6; ++i) {
    cin >> school[i];
    for (int j = 0; j < school[i].size(); ++j) {
      if (school[i][j] == '.') {
        dot[str].i = i;
        dot[str].j = j;
        str++;
      }
    }
  }
  sort(dot, dot + str, cmp);
  school[dot[str - 1].i][dot[str - 1].j] = 'P';
  for (int i = 0; i < 6; ++i) {
    cout << school[i] << endl;
  }
  delete[] school;
  return 0;
}
