Hard contest type trigonometry proof Suppose that real numbers $x, y, z$ satisfy:
$$\frac{\cos x + \cos y + \cos z}{\cos(x + y + z)}
=
\frac{\sin x + \sin y + \sin z}{\sin (x + y + z )}
= p$$
Then prove that:
$$\cos (x + y) + \cos (y + z ) + \cos (x + z) = p$$
I am not even getting where to start? Please help.

note 
$$\cos{(x+y)}=\cos{[(x+y+z)-z]}=\cos{(x+y+z)}\cos{z}+\sin{(x+y+z)}\sin{z}$$
and 
$$\cos{(y+z)}=\cos{(x+y+z)}\cos{x}+\sin{(x+y+z)}\sin{x}$$
$$\cos{(z+x)}=\cos{(x+y+z)}\cos{y}+\sin{(x+y+z)}\sin{y}$$
add this three
\begin{align*}
&\cos{(x+y)}+\cos{(y+z)}+\cos{(x+z)}\\
&=(\cos{x}+\cos{y}+\cos{z})\cos{(x+y+z)}+(\sin{x}+\sin{y}+\sin{z})\sin{(x+y+z)}\\
&=p\cos^2{(x+y+z)}+p\sin^2{(x+y+z)}\\
&=p
\end{align*}
