def path_to(r, n):
    """
    path_to finds a path from the root r to a node n, or None if no such path
    exists.
    """
    if r is None:
        return None
    if r == n:
        return [n]
    pl = path_to(r.left, n)
    if pl is not None:
        return [r] + pl
    pr = path_to(r.right, n)
    if pr is not None:
        return [r] + pr
    return None