What is the {student of} and the {student} of {Ludwig_van_Beethoven} ?
What did Ludwig van Beethoven study and who did he teach?
What was Ludwig van Beethoven a student of and who was a student?
SELECT ?p ?w WHERE { resource:Ludwig_van_Beethoven property:student_of ?p . resource:Ludwig_van_Beethoven property:student ?w }
 SELECT ?ans_1 ?ans_2 WHERE { ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q255> . ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P1066> . ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?ans_1. ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q255> . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P802> . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?ans_2. } 
SELECT ?ans_1 ?ans_2 WHERE { wd:Q255 wdt:P1066 ?ans_1 . wd:Q255 wdt:P802 ?ans_2 }
Archduke Rudolf of Austria Joseph Haydn Ferdinand Ries Joseph Haydn Carl Czerny Joseph Haydn Dorothea von Ertmann Joseph Haydn Babette Countess Keglevich de Buzin Joseph Haydn Archduke Rudolf of Austria Antonio Salieri Ferdinand Ries Antonio Salieri Carl Czerny Antonio Salieri Dorothea von Ertmann Antonio Salieri Babette Countess Keglevich de Buzin Antonio Salieri Archduke Rudolf of Austria Muzio Clementi Ferdinand Ries Muzio Clementi Carl Czerny Muzio Clementi Dorothea von Ertmann Muzio Clementi Babette Countess Keglevich de Buzin Muzio Clementi Archduke Rudolf of Austria Christian Gottlob Neefe Ferdinand Ries Christian Gottlob Neefe Carl Czerny Christian Gottlob Neefe Dorothea von Ertmann Christian Gottlob Neefe Babette Countess Keglevich de Buzin Christian Gottlob Neefe Archduke Rudolf of Austria Johann Georg Albrechtsberger Ferdinand Ries Johann Georg Albrechtsberger Carl Czerny Johann Georg Albrechtsberger Dorothea von Ertmann Johann Georg Albrechtsberger Babette Countess Keglevich de Buzin Johann Georg Albrechtsberger Archduke Rudolf of Austria Johann Baptist Schenk Ferdinand Ries Johann Baptist Schenk Carl Czerny Johann Baptist Schenk Dorothea von Ertmann Johann Baptist Schenk Babette Countess Keglevich de Buzin Johann Baptist Schenk Archduke Rudolf of Austria Gilles van der Eeden Ferdinand Ries Gilles van der Eeden Carl Czerny Gilles van der Eeden Dorothea von Ertmann Gilles van der Eeden Babette Countess Keglevich de Buzin Gilles van der Eeden