#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<string> h(6), g(6);
  h[0] = "33-44-33";
  h[1] = "33-44-33";
  h[2] = "22-33-22";
  h[3] = "22-33-22";
  h[4] = "11-22-11";
  h[5] = "11-22-11";
  int mx = 0, a = 0, b = 0;
  for (int i = 0; i < 6; i++) cin >> g[i];
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (h[i][j] == '-') continue;
      if (g[i][j] == '*') continue;
      if (h[i][j] - '0' > mx) {
        mx = h[i][j] - '0';
        a = i;
        b = j;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 8; j++) {
      if (i == a && j == b) {
        cout << "P";
      } else
        cout << g[i][j];
    }
    cout << endl;
  }
}
