Determining possible angles of projection

A particle is projected with a speed of $12\frac{\mathrm{m}}{\mathrm{s}}$ from the top of a cliff $50\mathrm{m}$ high. It lands on a boat $40\mathrm{m}$ from the bottom of the cliff. Determine the possible angles of projection.

I first considered motion in the vertical direction, taking $a=-9.8,~s=-50,~u=12\sin\theta$.

I ended up having to use the quadratic formula and obtained an equation involving $t$ and $\sin\theta$. When substituting my expression for $t$ into my equation for horizontal motion, I ran into difficulties because in similar questions (in which the projectile lands in the same horizontal plane), I end up getting $2\sin\theta \cos\theta$ somewhere in the calculations and I can use a double angle formula to find the angles.

This is what I ended up getting:

$$40=\frac{144\sin\theta \cos\theta+12\cos\theta \sqrt{144\sin^2\theta + 980}}{9.8}$$

Is there an identity I am supposed to use to solve this?

Let $T=\tan\theta$.
$$y=Tx-\frac {gx^2}{2v^2}(1+T^2)$$ Put $y=-50, x=40, v=12$, then solve quadratic in $T$.