Cellular automata approach to the n queens problem