Pan is related to Flat. Flat is a type of Plain. Plain is the opposite of Beautiful. Beautiful is similar to Lovely. 
Gas is a type of Compound. Gas is related to Sun. 
Pan <--RelatedTo--> Flat --IsA--> Plain <--Antonym--> Beautiful <--SimilarTo--> Lovely 
Compound <--IsA-- Gas <--RelatedTo--> Sun 