Use a variable or array to keep track of previous answers. On answer, set variable to a or b.
When displaying question 2, if variable is a, show question 2a. If variable is b, show question 2b. A similar idea can be applied to different answer choices as well.