def get_valid_fields(val: int, cs: dict) -> set:
    """
    A value is valid if there's at least one field's interval which contains it.
    """
    return {
        field
        for field, intervals in cs.items()
        if any(map(lambda i: i[0] <= val <= i[1], intervals))
    }