            let mut rule = Rule::new(name, ranges.next().unwrap());
            for range in ranges {
                rule.add(range);
            }

            rule
        });
    }
    assert_eq!(lines.next().unwrap(), "your ticket:");
    let your_ticket = parse_ticket(lines.next().unwrap());
    assert_eq!(lines.next().unwrap(), "");
    assert_eq!(lines.next().unwrap(), "nearby tickets:");
    let nearby_tickets = lines.map(parse_ticket).collect();
    Input {
        rules,