from typing import Tuple
import re


def read_data_from(file_: str) -> Tuple[dict, list, list]:
    """Read rules for, numbers on your, and numbers on nearby tickets."""
    file_str = open(file_, "r").read().splitlines()
    rules = {}
    for rule in file_str[:20]:
        key, b0, e0, b1, e1 = re.split(": |-| or ", rule)
        rules[key] = [int(b0), int(e0), int(b1), int(e1)]
    yours = list(map(int, file_str[22].split(",")))
    nearby = []
    for ticket in file_str[25:]:
        nearby.append(list(map(int, ticket.split(","))))
    return rules, yours, nearby