def save_cities_into_file(
    cities: list[tuple[float, float]],
    size: int,
    map_num: int,
    comment: str = ""
) -> str:
    """
    Given a list of cities, save the data into a file in TSPLIB format

    @param cities: A list of the coordinates of the cities
    @param size: the average difference in distance between all the cities
    @param map_num: integer representing the number of the map with same size and city counts
    @param comment: the comment to add in the file
    @return: the path to the file
    """
    n = len(cities)
    name = f"rand{n}_{size}_{map_num}"
    filename = f"data/{name}.tsp"
    with open(filename, "w+") as f:
        f.writelines([
            f"NAME : {name}\n",
            f"COMMENT : {comment}\n",
            "TYPE : TSP\n",
            f"DIMENSION : {n}\n",
            "EDGE_WEIGHT_TYPE : EUC_2D\n",
            "NODE_COORD_SECTION\n"
        ])
        for i, city in enumerate(cities):
            f.write(f"{i + 1}\t{city[0]}\t{city[1]}\n")
        f.write("EOF\n")
    return filename