0 to'P'map{i=>0 to'P'map{j=>print(if(Seq(1,3,9,27)forall(r=>i/r%3%2==j/r%3%2))"X"else" ")};println}