from typing import MutableMapping
from typing import Any


def walk_the_tree(tree: MutableMapping[str, Any], stem: list[str] = []) -> list[list[str]]:
    """Return the leaves of the branches."""
    leaves = []
    for branch, branches in tree.items():
        leaf = stem + [branch, ]
        if isinstance(branches, dict):
            leaves.extend(walk_the_tree(branches, leaf))
        else:
            leaves.append(leaf)
    return leaves