Another way to approach this is to test each option's shaft speed directly and see which one produces exactly 16.67 Hz at the generator.
The motor's synchronous speed on the 50 Hz grid, for pole count $P_m$, is $N_s=\dfrac{120\times50}{P_m}=\dfrac{6000}{P_m}$.
Testing option (A), $P_m=2$: $N_s=6000/2=3000$ rpm. Generator frequency with $P_g=6$: $f_g=\dfrac{N_sP_g}{120}=\dfrac{3000\times6}{120}=150$ Hz. Far too high.
Testing option (B), $P_m=6$: $N_s=6000/6=1000$ rpm. Generator frequency with $P_g=2$: $f_g=\dfrac{1000\times2}{120}=16.67$ Hz. This matches the required output frequency exactly.
Testing option (C), $P_m=4$: $N_s=6000/4=1500$ rpm. Generator frequency with $P_g=6$: $f_g=\dfrac{1500\times6}{120}=75$ Hz. Too high.
Testing option (D), $P_m=6$: $N_s=1000$ rpm. Generator frequency with $P_g=4$: $f_g=\dfrac{1000\times4}{120}=33.3$ Hz. Still too high.
Only option (B) reproduces the required 16.67 Hz output.
\[ \boxed{6\text{ poles (motor)},\ 2\text{ poles (generator)}} \]