#include <bits/stdc++.h>
using namespace std;
int mas[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}};
int main() {
  char m[6][6];
  for (int i = 0; i < 6; i++) {
    string line;
    getline(cin, line);
    int cur = 0;
    for (int j = 0; j < line.size(); j++)
      if (line[j] != '-') m[i][cur++] = line[j];
  }
  int ansx = -1;
  int ansy = -1;
  int maxi = 0;
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++)
      if (m[i][j] == '.') {
        if (mas[i][j] > maxi) {
          maxi = mas[i][j];
          ansx = i;
          ansy = j;
        }
      }
  m[ansx][ansy] = 'P';
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      if (j == 2 || j == 4) putchar('-');
      putchar(m[i][j]);
    }
    putchar('\n');
  }
  return 0;
}
