A patient with a tumor in the right infratemporal fossa shows a significant shift of the mandible to the right when opening. Which nerve is involved?

Trigeminal nerve V

Facial nerve VII.

Glossopharyngeal nerve IX.

Hypoglossal nerve XII.