A solution to the eight queens puzzle