what is the {replaced by} for {Nelson Mandela} has {position held} as {President of South Africa} ?
Give me the name of the person Nelson Mandela replaced as the President of South Africa.
Who did Nelson Mandela replace as the President of South Africa?
SELECT ?h WHERE { resource:Nelson_Mandela property:position_held ?q . ?q property:replaced_by ?h . ?q property:position_held resource:President_of_South_Africa }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q8023> .
?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/Q273884> .
?statement <http://www.wikidata.org/entity/P1366> ?value. 
} 

SELECT ?value WHERE { wd:Q8023 p:P39 ?s . ?s ps:P39 wd:Q273884 . ?s pq:P1366 ?value}