Solution (source code)

= Solution

Put $u=\sqrt m\bar X$ and $v=\sqrt n\bar Y$. Test (a) accepts inside the disc
$$
u^2+v^2\leq q_2,\qquad q_2=F_2^{-1}(1-\alpha),
$$
whereas $Z$ is the projection of $(u,v)$ onto the unit <vector>
$$
\left(\sqrt{\frac n{m+n}},-\sqrt{\frac m{m+n}}\right).
$$
If $q_1=[\Phi^{-1}(1-\alpha/2)]^2$, then $q_1$ is the corresponding $\chi^2_1$ quantile. Since a $\chi^2_2$ variable is stochastically larger than a $\chi^2_1$ variable, $q_2>q_1$. Choose a point on that unit-vector line with squared radius strictly between $q_1$ and $q_2$. A whole open neighborhood then makes (b) reject while (a) accepts. The joint normal density of $(\bar X,\bar Y)$ is strictly positive everywhere for every true $(\lambda,\mu)$, so this neighborhood always has positive probability.