In chess a queen moves any distance along a row, a column, or a diagonal, and attacks the pieces on that path.
The queens on bad terms puzzle asks you to place eight queens on an 8x8 board so that no two of them attack each other. Two queens attack each other when they share a row, share a column, or lie on the same diagonal.
You are given one board with queens on it. Decide whether the placement is a correct solution of the puzzle. The placement is correct only when the board holds exactly eight queens and no two of them attack each other.
The board is given as eight lines. Each line has eight characters.
Each character is . or *. A . is an empty square and a * is a square that holds a queen.
Print valid on one line if the placement is a correct solution, and invalid otherwise.