The mneumonic “Standing Room Only” can help you remember this. V1 passes through the Superior orbital fissure, V2 goes through the foramen Rotundum, and V3 passes through the foramen Ovale.
The main thing to remember in ophthalmology, however, is that only V1 and V2 pass through the cavernous sinus. If you suspect a cavernous process and V3 is involved, you may need to rethink your differential.