Out of 5 apples 1 is infested, so out of 6 times as many apples (30 apples) 6 must be in infested.
We take 30 apples out of 36, leaving 6. One may be infested. So we could end up with 7 infested apples.
If we have 7 infested apples out of 36, we are left with 29 good apples out of 36: 24 from the batch of 30 and 5 from the remaining 6 apples.