getParents function