from typing import List
from typing import Tuple
from typing import Dict


def convert(day_input: List[str]) -> Tuple[Dict[str, List[range]], List[int], List[List[int]]]:
    """Converts the input into a tuple with:
    1. A dictionary with the fields, where for each field the value is a list
    of the valid ranges, each represented as a tuple with the min and max value
    2. The values for your ticket, a list of ints
    3. A list with the values for the other tickets"""
    iter_in = iter(day_input)
    # Convert fields
    fields = {}
    for line in iter_in:
        if line == '': break
        key, vals = line.split(': ')
        fields[key] = [range(int(v.split('-')[0]), int(v.split('-')[1]) + 1 ) for v in vals.split(' or ')]

    while next(iter_in) != 'your ticket:':
        continue
    our = [int(n) for n in next(iter_in).split(',')]

    while next(iter_in) != 'nearby tickets:':
        continue
    tickets = [[int(n) for n in line.split(',')] for line in iter_in]
    return (fields, our, tickets)