from pathlib import Path


def read_scanners(filename: Path) -> list[list]:
    """Read the raw scanner inputs.

    Args:
        filename (Path): filename

    Returns:
        list[list] scanned beacon positions for each scanner
    """
    result = []
    with filename.open("r") as file:
        for line in file:
            if "scanner" in line:
                result.append([])
            else:
                pos = list(
                    map(
                        int,
                        "".join(c if c in "1234567890-" else " " for c in line).split(),
                    )
                )
                if len(pos) == 3:
                    result[-1].append(tuple(pos))
    return result