#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e7 + 10;
const double PI = 3.141592653589;
bool isQuery = false;
bool isValidParenthesis(string s) {
  int c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(')
      c++;
    else
      c--;
    if (c < 0) return false;
  }
  return c == 0;
}
int longestPrefixSuffix(string s) {
  int n = s.length();
  int lps[n], len = 0, i = 1;
  lps[0] = 0;
  while (i < n) {
    if (s[i] == s[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len)
        len = lps[len - 1];
      else
        lps[i++] = 0;
    }
  }
  return lps[n - 1];
}
int power(int x, int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return power(x, n / 2) * power(x, n / 2);
  else
    return x * power(x, n / 2) * power(x, n / 2);
}
int powerMod(int x, int n, int mod) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return (powerMod(x, n / 2, mod) * powerMod(x, n / 2, mod)) % mod;
  else
    return (x * powerMod(x, n / 2, mod) * powerMod(x, n / 2, mod)) % mod;
}
vector<string> v(6), pre(6);
void set_data(int x, int y, char val) {
  for (int i = x; i < x + 2; i++) {
    for (int j = y; j < y + 2; j++) {
      pre[i][j] = val;
    }
  }
}
void solve() {
  int n = 6, m = 8;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  set_data(0, 0, '3');
  set_data(2, 3, '3');
  set_data(0, 6, '3');
  set_data(0, 3, '4');
  set_data(4, 0, '1');
  set_data(4, 6, '1');
  set_data(2, 0, '2');
  set_data(4, 3, '2');
  set_data(2, 6, '2');
  int x, y, mini = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (j == 2 || j == 5) continue;
      int num = pre[i][j] - '0';
      if (v[i][j] == '.') {
        if (num > mini) {
          mini = num;
          x = i, y = j;
        }
      }
    }
  }
  v[x][y] = 'P';
  for (auto i : v) {
    cout << i << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  if (isQuery) cin >> t;
  while (t--) {
    solve();
  }
}
