#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f;
const long long MOD = 1000000007;
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long i, j, k, l, n, m, sum, maxx, minn, ans, x, y, flag, cc;
char a[6][8];
int main() {
  for (int i = (0); i < (6); i++) {
    for (int j = (0); j < (8); j++) cin >> a[i][j];
    getchar();
  }
  if (a[0][3] == '.')
    a[0][3] = 'P';
  else if (a[0][4] == '.')
    a[0][4] = 'P';
  else if (a[1][3] == '.')
    a[1][3] = 'P';
  else if (a[1][4] == '.')
    a[1][4] = 'P';
  else if (a[2][3] == '.')
    a[2][3] = 'P';
  else if (a[2][4] == '.')
    a[2][4] = 'P';
  else if (a[3][3] == '.')
    a[3][3] = 'P';
  else if (a[3][4] == '.')
    a[3][4] = 'P';
  else if (a[0][0] == '.')
    a[0][0] = 'P';
  else if (a[0][1] == '.')
    a[0][1] = 'P';
  else if (a[1][0] == '.')
    a[1][0] = 'P';
  else if (a[1][1] == '.')
    a[1][1] = 'P';
  else if (a[0][6] == '.')
    a[0][6] = 'P';
  else if (a[0][7] == '.')
    a[0][7] = 'P';
  else if (a[1][6] == '.')
    a[1][6] = 'P';
  else if (a[1][7] == '.')
    a[1][7] = 'P';
  else if (a[4][3] == '.')
    a[4][3] = 'P';
  else if (a[4][4] == '.')
    a[4][4] = 'P';
  else if (a[5][3] == '.')
    a[5][3] = 'P';
  else if (a[5][4] == '.')
    a[5][4] = 'P';
  else if (a[2][0] == '.')
    a[2][0] = 'P';
  else if (a[2][1] == '.')
    a[2][1] = 'P';
  else if (a[3][0] == '.')
    a[3][0] = 'P';
  else if (a[3][1] == '.')
    a[3][1] = 'P';
  else if (a[2][6] == '.')
    a[2][6] = 'P';
  else if (a[2][7] == '.')
    a[2][7] = 'P';
  else if (a[3][6] == '.')
    a[3][6] = 'P';
  else if (a[3][7] == '.')
    a[3][7] = 'P';
  else if (a[4][0] == '.')
    a[4][0] = 'P';
  else if (a[4][1] == '.')
    a[4][1] = 'P';
  else if (a[5][0] == '.')
    a[5][0] = 'P';
  else if (a[5][1] == '.')
    a[5][1] = 'P';
  else if (a[4][6] == '.')
    a[4][6] = 'P';
  else if (a[4][7] == '.')
    a[4][7] = 'P';
  else if (a[5][6] == '.')
    a[5][6] = 'P';
  else if (a[5][7] == '.')
    a[5][7] = 'P';
  for (int i = (0); i < (6); i++) {
    for (int j = (0); j < (8); j++) cout << a[i][j];
    cout << endl;
  }
  return 0;
}
