Getting back to the past in the union-find problem