Solution to N Queen II problem