class EulerTour:
    def __init__(self, tree):
        self._tree = tree

    def tree(self):
        return self._tree

    def execute(self):
        if len(self._tree) > 0:
            return self._tour(self._tree.root(), 0, [])

    def _tour(self, p, d, path):
        self._previsit(p, d, path)
        results = []
        path.append(0)
        for c in self._tree.children(p):
            results.append(self._tour(p, d+1, path))
            path[-1] += 1
        path.pop()
        answer = self._postvisit(p, d, path, results)
        return answer

    def _previsit(self, p, d, path):
        pass

    def _postvisit(self, p, d, path, results):
        pass
