A circle is inscribed into the triangle \(ABC\) with sides \(BC=6, AC=10\) and \(AB= 12\). A line tangent to the circle intersects two longer sides of the triangle \(AB\) and \(AC\) at the points \(F\) and \(G\) respectively. Find the perimeter of the triangle \(AFG\).