Use lists P and H to compute descendant test