def remove_max_edge_from_cycle(tree, cycle):
    """
    Remove the max-weighted edge from a *cycle* which is contained in the given *tree*.
    """
    cycle = sorted(cycle, key=lambda edge: int(edge.weight), reverse=True)
    return tree.remove(cycle[0])