from typing import List
from typing import Tuple


def parse_data(file_name: str) -> List[List[Tuple[int, int]]]:
    """
    Read data from a file and save it into a nested list.
    Nested lists consists of two coordinates - 2 tuples, each with 2 digits.
    Eg. line 0,9 -> 5,9 will produce [ [ (0, 9), (5, 9) ] ]

    Args:
        file_name (str): name of file in folder / or absolute path

    Returns:
        List[List[Tuple[int, int]]]: a nested list of coordinates
    """
    list_of_coordinates: list = []

    with open(file_name, encoding="utf-8") as f:
        for line in f:
            el1, el2 = line.rstrip().split("->")
            el1 = tuple(map(int, el1.split(",")))
            el2 = tuple(map(int, el2.split(",")))
            list_of_coordinates.append([el1, el2])

    return list_of_coordinates