print all ancestors of a given node