Largest possible side of a triangle when $\cos(3P)+ \cos(3Q)+ \cos(3R) = 1$. 
In triangle $PQR$, $\cos(3P)+ \cos(3Q)+ \cos(3R) = 1$. Two sides of the
triangle have lengths of $15 cm$ and $18 cm$. If the length of the
third side of the triangle PQR is $\sqrt{m}$ cm, then the largest
possible value that $'m'$ can take is?

At first I thought the information given i.e.  $\cos(3P)+ \cos(3Q)+ \cos(3R) = 1$ to be a distraction and I went with the usual way to solve this problem that sum of two sides is always greater than the third side. So;

$15+18>\sqrt{m}$ $\Rightarrow m<1089$

So highest value that $m$ can take is $1088$ but this was the wrong answer. Then I used the cosine rule as follows :- 
$\cos P=\frac{15^2+18^2-m}{2.15.18}$
$\Rightarrow -1 \le \frac{15^2+18^2-m}{2.15.18} \le1 $
$\Rightarrow9 \le m \le1089$
So from here I got the highest value of $m$ to be 1089 but this was also wrong. Now I am stuck as I am not able to think how to solve this question. I think I need to use the given condition some how to get to the answer but how? Please help me on this !!!
Thanks in advance !!!

Let $p$, $q$ and $r$ be sides-lengths of the triangle.
Thus, $$\sum_{cyc}\left(4\left(\frac{p^2+q^2-r^2}{2pq}\right)^3-3\cdot\frac{p^2+q^2-r^2}{2pq}\right)=1$$ or
$$\prod_{cyc}((p+q-r)(p^2+q^2+pq-r^2))=0,$$ which says that one of the measured angles of the triangle is equal to $120^{\circ}$.
Can you end it now?
I got $m=819$.
Another way:
$$\cos3P+\cos3Q+\cos3R-1=2\cos\frac{3P+3Q}{2}\cos\frac{3P-3Q}{2}-2\sin^2\frac{3R}{2}=$$
$$=2\cos\left(270^{\circ}-\frac{3R}{2}\right)\cos\frac{3P-3Q}{2}-2\sin^2\frac{3R}{2}=$$
$$=-2\sin\frac{3R}{2}\left(\cos\frac{3P-3Q}{2}+\sin\frac{3R}{2}\right)=$$
$$=-2\sin\frac{3R}{2}\left(\cos\frac{3P-3Q}{2}+\sin\frac{3(180^{\circ}-P-R)}{2}\right)=$$
$$=-2\sin\frac{3R}{2}\left(\cos\frac{3P-3Q}{2}-\cos\frac{3P+3Q}{2}\right)=-4\sin\frac{3R}{2}\sin\frac{3P}{2}\sin\frac{3Q}{2}$$ and we get the same result.
