What is {history} of {religious affiliation} of {Elijah Muhammad} ?
What is Elijah Muhammad's past religion?
What is {history} of {Elijah Muhammad's} {religious affiliation}  ?
SELECT ?d WHERE { ?f property:history_of_topic ?d . resource:Elijah_Muhammad property:religion ?f }
SELECT ?answer WHERE { ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q345182> . ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P140>. ?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?X . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?X. ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P2184> . ?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?answer . }
SELECT ?answer WHERE { wd:Q345182 wdt:P140 ?X . ?X wdt:P2184 ?answer}