On dividing 3x3+x2+2x+5 by a polynomial g(x), the quotient and remainder are (3x-5) and (9x+10) respectively. Find g(x).