Answer
$6\;\rm mm$
Work Step by Step
Since both are having the same $f$-number, we need to find the $f$-number for the first lens. It is given by
$$f_{\rm number}=\dfrac{f}{D}$$
$$f_{\rm number}=\dfrac{f_1}{D_1}=\dfrac{12 }{4}=\bf 3$$
Now we can find the aperture diameter of the second lens,
$$D_2=\dfrac{f_2}{f_{\rm number}}=\dfrac{18}{3}$$
Thus,
$$D_2=\color{red}{\bf 6}\;\rm mm$$