If you're solving for g then move all terms to the left side and set equal to zero. Then set each factor equal to zero.
And your answer becomes [tex] g=\frac{5r}{r-39} [/tex]
If you're solving for r then then move all terms to the left side and set equal to zero. Then set each factor equal to zero and your answer is [tex] r=\frac{39g}{g-5} [/tex]