Since the questions states these two shapes are "similar" the side will have identical scale factors.
Divide the longest side of the bigger shape to the smaller shape.
39 / 30 = 1.3
The scale factor is 1.3.
Now, multiply the shortest side if the smaller shape by the scale factor.
10 * 1.3 = 13
Therefore, the length of w is 13mm
Best of Luck!