Checking if a point is a solution