Here is a top-down derivation for the query ?g, where we always select the leftmost atom to resolve against:
yes <- g yes <- c & d yes <- h & e & d yes <- e & d yes <- h & d yes <- d yes <- e yes <- h yes <-