In chess, a knight moves in an L shape. As Figure A.1 shows, it moves two squares sideways and then one square up or down, or one square sideways and then two squares up or down.
In the Nine Knights puzzle you place exactly nine knights on a 5×5 board so that no knight can attack another knight in a single move. The configuration in Figure A.2 is not a solution because two of the knights attack each other. The configuration in Figure A.3 is a solution.
Given one configuration, decide whether it is a valid solution to the Nine Knights puzzle.