#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<long>> m;
  vector<long> b;
  b.push_back(3);
  b.push_back(3);
  b.push_back(4);
  b.push_back(4);
  b.push_back(3);
  b.push_back(3);
  m.push_back(b);
  b.clear();
  b.push_back(3);
  b.push_back(3);
  b.push_back(4);
  b.push_back(4);
  b.push_back(3);
  b.push_back(3);
  m.push_back(b);
  b.clear();
  b.push_back(2);
  b.push_back(2);
  b.push_back(3);
  b.push_back(3);
  b.push_back(2);
  b.push_back(2);
  m.push_back(b);
  b.clear();
  b.push_back(2);
  b.push_back(2);
  b.push_back(3);
  b.push_back(3);
  b.push_back(2);
  b.push_back(2);
  m.push_back(b);
  b.clear();
  b.push_back(1);
  b.push_back(1);
  b.push_back(2);
  b.push_back(2);
  b.push_back(1);
  b.push_back(1);
  m.push_back(b);
  b.clear();
  b.push_back(1);
  b.push_back(1);
  b.push_back(2);
  b.push_back(2);
  b.push_back(1);
  b.push_back(1);
  m.push_back(b);
  b.clear();
  long max = 0;
  long out_j = 0, out_i = 0;
  vector<string> list;
  for (int i = 0; i < 6; i++) {
    string x;
    cin >> x;
    list.emplace_back(x);
  }
  for (int i = 0; i < 6; i++) {
    int c = 0;
    for (int j = 0; j < list[i].size(); j++) {
      if (list[i][j] == '.') {
        if (m[i][c] > max) {
          max = m[i][c];
          out_j = j;
          out_i = i;
        }
      }
      if (list[i][j] == '-') {
        c--;
      }
      c++;
    }
  }
  for (int i = 0; i < 6; i++) {
    if (i == out_i) {
      for (int j = 0; j < list[i].size(); j++) {
        if (j == out_j) {
          cout << "P";
        } else {
          cout << list[i][j];
        }
      }
      cout << "\n";
    } else {
      cout << list[i] << "\n";
    }
  }
  return 0;
}
