When did William Petty stop being UK Prime Minister?
SELECT ?value WHERE { wd:Q312573 p:P39 ?s . ?s ps:P39 wd:Q14211 . ?s pq:P582 ?value}
william petty, 2nd earl of shelburne: Q312573 prime minister of the united kingdom: Q14211