2014 AIME II Problem 12

Suppose that the angles of \triangle A B C satisfy \cos (3 A)+\cos (3 B)+\cos (3 C)=1. Two sides of the triangle have lengths 10 and 13 . There is a positive integer m so that the maximum possible length for the remaining side of \triangle A B C is \sqrt{m}. Find m.