#include <bits/stdc++.h>
int cost[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}};
using namespace std;
int main() {
  char a[6][6], b[6][6], c;
  for (int i = 0; i < 6; i++)
    cin >> a[i][0] >> a[i][1] >> c >> a[i][2] >> a[i][3] >> c >> a[i][4] >>
        a[i][5];
  int max = -1, maxi, maxj;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      if (a[i][j] == '.' && cost[i][j] > max) {
        max = cost[i][j];
        maxi = i;
        maxj = j;
      }
      b[i][j] = a[i][j];
    }
  }
  b[maxi][maxj] = 'P';
  for (int i = 0; i < 6; i++)
    cout << b[i][0] << b[i][1] << '-' << b[i][2] << b[i][3] << '-' << b[i][4]
         << b[i][5] << endl;
  return 0;
}
