#include <bits/stdc++.h>
int main() {
  int cost[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}};
  char now[6][6];
  for (int i = 0; i < 6; i++) {
    scanf("%c%c-%c%c-%c%c\n", &now[i][0], &now[i][1], &now[i][2], &now[i][3],
          &now[i][4], &now[i][5]);
  }
  int mx = -1, x = -1, y = -1;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      if (cost[i][j] > mx && now[i][j] == '.') {
        x = i;
        y = j;
        mx = cost[i][j];
      }
    }
  }
  now[x][y] = 'P';
  for (int i = 0; i < 6; i++) {
    printf("%c%c-%c%c-%c%c\n", now[i][0], now[i][1], now[i][2], now[i][3],
           now[i][4], now[i][5]);
  }
  return 0;
}
