### How to program in Sagemath using the first root of an equation that needs to be entered in the coefficients of another equation to solve it

How to program in Sagemath using the first root of an equation that needs to be entered in the coefficients of another equation to solve it. Then, in a second iteration use the second root in the same way as the previous one, then in a third iteration use the third root in the same way as the previous roots, and so on, until all the roots of the first equation are used in the coefficients of the second equation. For example, the equation:
-(4f^2 q + 5f^2 r - 4q^2 + 5fr - 3qr) = 0
has two roots, f_1 and f_2, where q and r are real numbers. and I want to solve the following another equation:
-1/5(20f^2 hq + 20f^2 iq + 40fgq + 40fhq - 8fq^2 - 20hq^2 - 20iq^2 + 50fgr + 100fhr + 50fir - 4q^2 + 25gr + 25hr - 50qr - 25r^2) = 0
which is linearly dependent on variables g, h and i. But, it will give us one root ~~h_1(i) ~~g_1(h, i) if we enter f_1 in this 2nd equation, or ~~h_2(i) ~~g_2(h, i) if we enter f_2 in ~~it.~~it. And although the process continues with other equations, let's leave it here for now.