Solve this by drawing the reflex arc rather than memorising option pairs.
Every reflex needs a sensor (afferent), a centre, and an effector (efferent). For the gag reflex:
Afferent limb - a foreign touch on the back of the throat (posterior pharynx and posterior one-third of the tongue) is detected and the signal runs in the glossopharyngeal nerve, CN IX.
Centre - the nucleus solitarius/nucleus ambiguus in the medulla.
Efferent limb - the medulla fires back along the vagus nerve, CN X, contracting the pharyngeal constrictor muscles and lifting the soft palate, producing the gag.
So the arc is built from CN IX and CN X. If either of these is damaged the loop is broken and the gag reflex disappears. That gives the pair 9 and 10.
Cross-checking the wrong pairs: CN V is sensation to the face and front of the tongue, CN VII is facial movement and front-tongue taste, and CN XII only moves the tongue body - none of them forms part of the pharyngeal reflex circuit, so any option containing 5, 7 or 12 is wrong.
The gag reflex is therefore lost with injury to cranial nerves 9 and 10 (option B).