Working solution for 8queens