what is the {replaced by} for {Aga Khan III} has {position held} as {Ismaili imam} ?
Who replaced Aga Khan III as the Islmaili imam?
SELECT ?value WHERE { wd:Q366213 p:P39 ?s . ?s ps:P39 wd:Q38998920 . ?s pq:P1366 ?value}
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q366213> .
?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> <http://wikidata.dbpedia.org/resource/Q38998920> .
?statement <http://www.wikidata.org/entity/P1366> ?value. 
} 

Which person took over the Islmaili imam over Aga Khan III?