def sort_instances(instances: list[str]) -> list[str]:
    return sorted(instances, key=lambda x: int(x.split("_")[-1].split(".")[0]))


def sort_networks(networks: list[str]) -> list[str]:
    return sorted(
        networks,
        key=lambda x: int(x.split("_")[-1].split(".")[0])
        if x.split("_")[-1].split(".")[0].isdigit()
        else float("inf"),
    )


def sort_SB(instances: list[str]) -> list[str]:
    return sorted(instances, key=lambda x: int(x.split("_")[2]))
