from helpers.file import load_file
from helpers.list import FluxList

def run9() -> tuple[str, str]:
    places = set()

    def format_data(str : str) -> tuple[str, str, int]:
        split = str.split(' ')
        place_a, place_b = split[0], split[2]
        places.add(place_a)
        places.add(place_b)
        return (place_a, place_b, int(split[-1]))

    data = FluxList(load_file(9, True)) \
        .map(lambda s, i : format_data(s))

    places = list(places)
    places.sort()

    data = data \
        .map(lambda x, i : (places.index(x[0]), places.index(x[1]), x[2]))

    places_count = len(places)

    grid = [[0 for _ in range(places_count)] for _ in range(places_count)]

    for i in range(data.count()):
        cell_data = data.at(i)
        grid[cell_data[0]][cell_data[1]] = cell_data[2]
        grid[cell_data[1]][cell_data[0]] = cell_data[2]

    return ("", "")
