program e;

var plocha: array [1..8, 1..8] of char;

procedure vykresli;
var i, j: integer;
    hrube: boolean;
begin
	for i:=1 to 8 do begin
		writeln('+---+---+---+---+---+---+---+---+');
		for j:=1 to 8 do begin
			hrube := (i+j) mod 2 = 1;
			write('|');
			if hrube then write(':') else write('.');
			if plocha[i, j] <> #0 then 
				write(plocha[i, j])
			else
				if hrube then write(':') else write('.');
			if hrube then write(':') else write('.');
		end;
		writeln('|');
	end;
	writeln('+---+---+---+---+---+---+---+---+');
end;



function stlpec(c: char): integer;
begin
	stlpec := ord(c)-ord('a')+1;
end;

procedure vykresli2;
var i, j: integer;
begin
	for i:= 1 to 8 do begin
		for j:=1 to 8 do begin
			write(plocha[i,j]);
		end;
		writeln;
	end;
end;


var vstup: string;
	i, riad, stlp: integer;
begin	
	readln(vstup);
	i:=8;
	while i<36 do begin
		stlp := stlpec(vstup[i+1]);
		riad := 9-(ord(vstup[i+2])-ord('0'));		
		plocha[riad, stlp] := vstup[i];
		i:=i+4;
	end;
	while i<59 do begin
		stlp := stlpec(vstup[i]);
		riad := 9-(ord(vstup[i+1])-ord('0')); 
		plocha[riad, stlp] := 'P';
		i:=i+3;
	end;
	
	{ cierne }
	readln(vstup);
	i:=8;
	while i<36 do begin
		stlp := stlpec(vstup[i+1]);
		riad := 9-(ord(vstup[i+2])-ord('0'));		
		plocha[riad, stlp] := chr(ord(vstup[i])+32);
		i:=i+4;
	end;
	while i<59 do begin
		writeln(vstup[i], ' ', vstup[i+1]);
		stlp := stlpec(vstup[i]);
		riad := 9-(ord(vstup[i+1])-ord('0')); 
		plocha[riad, stlp] := 'p';
		i:=i+3;
	end;		
	vykresli;				
end.