import std.stdio;

void main(string[] args) {
    int done = 0;
    string[6] data;
    for (int i = 0; i < 6; i++)
    {
        data[i] = std.stdio.readln();
        // data[i] = std.string.stripRight(data[i]);
    }
    
    
    
    int[][] cost = [
        [ 3, 3, 0, 4, 4, 0, 3, 3 ],
        [ 3, 3, 0, 4, 4, 0, 3, 3 ],
        [ 2, 2, 0, 3, 3, 0, 2, 2 ],
        [ 2, 2, 0, 3, 3, 0, 2, 2 ],
        [ 1, 1, 0, 2, 2, 0, 1, 1 ],
        [ 1, 1, 0, 2, 2, 0, 1, 1 ]
    ];
    
    int ansi = 0;
    int ansj = 0;
    int value = -1;
    
    for (int i = 0; i < 6; i++)
    {
        for (int j = 0; j < 8; j++)
    	{
            if (data[i][j] == '.' && value < cost[i][j]) {
                value = cost[i][j];
                ansi = i;
                ansj = j;
            }
        }
    }
    
    for (int i = 0; i < 6; i++)
    {
        if (i == ansi) {
            std.stdio.write(data[i][0..ansj]);
            std.stdio.write('P');
            std.stdio.writeln(data[i][ansj+1..8]);
        } else {
            std.stdio.write(data[i]);
        }
    }
}