Posterior superior nasal nerves

The (medial and lateral) posterior superior nasal nerves are branches of the maxillary nerve (CN V2)  that arise in the pterygopalatine fossa from pterygopalatine ganglion  and pass through the sphenopalatine foramen into the nasal cavity  to innervate the nasal septum (the medial nerves), and the posterosuperior portion of the lateral wall of the nasal cavity (the lateral nerves).

Median posterior superior nasal nerves
The median posterior superior nasal nerves traverse the roof of the nose to be distributed to the nasal septum. 

The largest of the median posterior superior nasal nerves is the nasopalatine nerve (which continues out of the nasal cavity to the hard palate). 

Lateral posterior superior nasal nerves
The lateral posterior superior nasal nerves pass anterior-ward in the nasal cavity to be distributed to the posterosuperior portion of the lateral wall of the nasal cavity.