All gray animals are intelligent. So, All whales are intelligent mammals. All whales are gray. All gray animals are intelligent. So, All whales are intelligent.
All whales are mammals.
So, All whales are intelligent mammals. Each of those arguments would be analyzed in turn, and the entire Sorites would only be valid if each of its sub-arguments were valid. E.g., All maidens are women. No women are bachelors. So, No bachelors are maidens.