Refactor one more exercise that was using the ast

Test plan: Load factoring_polynomials_with_two_variables.html in local mode, take hints, answer correctly/incorrectly

Auditors: alex