$_="- - -\n"x3; $"=o;W:while($"=($"eq x?o:x)){$i=0;$O=$_;$O =~s/-/$i++/ge;print$O.$";$H=<>;$w=0;s/-/$w++==$H?$":$&/egs ;$B=$_;for$P(o,x){s/$P{3}/$&/;s/($P . .\n){3}/$&/; s/(. $P .\n){3}/$&/;s/(. . $P\n){3}/$&/; s/$P . .\n. $P .\n. . $P/$&/;s/. . $P\n. $P .\n$P . ./$&/; last(W)if$&=~m/o|x/}$_=$B}print