Find the number of ways of placing three As, three Bs, and three Cs in a 3 \times 3 grid, so that every square contains one letter, and each diagonals contains one A, one B, and one C.