What is {position held} of {Benedict XVI} that is {replaces} is {John Paul II} ?
What position  does  Benedict XVI that replaced John Paul II hold?
What is the position of Benedict XVI that replaces John Paul II?
SELECT ?q WHERE { ?j property:position_held ?q . resource:Benedict_XVI property:position_held ?j . ?j property:replaces resource:John_Paul_II }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q2494> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P39> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P1365> <http://wikidata.dbpedia.org/resource/Q989>
} 

SELECT ?obj WHERE { wd:Q2494 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1365 wd:Q989 }