I am supposed to find the product of the following reaction:
I know that six-membered rings are more stable than five-membered rings, but the C-D bonds are stronger, so it confuses me where will the attack happen.
In both cases, it would form a 6-membered ring (I can't see where you spotted a 5-membered ring product). The alpha hydrogen of the aldehyde (pKa around 17) is more acidic than the alpha deuterium of the ketone (pKa around 20) since neighboring alkyl groups tend to destabilize carbanions by donating electron density. Furthermore, as you mentioned, C-D bonds are slightly stronger than C-H so it is safe to say that the enolate will form on the alpha carbon at the aldehyde side. (I'm sorry I wrote the carbanion attacks the carbonyl, to be more correct I should've written the enol double bond acting as the nucleophile, not the carbanion. For practical purposes, it makes no difference though.)
Information on the acidity of alpha hydrogens: http://www.chem.ucalgary.ca/courses/350/Carey5th/Ch21/ch21-2.html