import time;
ms = time.time() * 1000
x = [
"dark indigo bags contain 2 clear indigo bags.",
"mirrored gold bags contain 2 pale blue bags, 1 dark violet bag.",
"dim aqua bags contain 1 mirrored beige bag.",
"dim fuchsia bags contain 5 dark red bags, 1 muted green bag, 4 clear indigo bags.",
"shiny fuchsia bags contain 4 wavy teal bags, 4 dim cyan bags, 4 light green bags, 1 vibrant tomato bag.",
"posh chartreuse bags contain 2 faded blue bags, 2 pale plum bags, 2 posh coral bags, 4 vibrant bronze bags.",
"striped red bags contain 3 vibrant red bags.",
"striped purple bags contain 5 shiny brown bags.",
"dark silver bags contain 1 dull aqua bag, 4 dim magenta bags.",
"dark chartreuse bags contain 2 plaid black bags, 4 light bronze bags, 5 dotted cyan bags.",
"shiny turquoise bags contain 1 shiny brown bag.",
"shiny crimson bags contain no other bags.",
"clear purple bags contain 4 bright red bags.",
"dim white bags contain 4 posh violet bags, 2 light orange bags.",
"plaid lime bags contain 4 muted silver bags, 2 vibrant tan bags.",
"clear fuchsia bags contain 3 muted purple bags, 4 striped coral bags.",
"dim plum bags contain 4 posh purple bags, 2 faded tomato bags, 1 mirrored magenta bag, 3 dull lime bags.",
"dull white bags contain 4 light silver bags, 5 drab purple bags, 2 wavy orange bags, 1 striped coral bag.",
"dull tomato bags contain 3 clear cyan bags, 5 dark turquoise bags, 4 light orange bags, 3 vibrant red bags.",
"plaid tan bags contain 5 faded brown bags, 5 bright bronze bags.",
"mirrored fuchsia bags contain 5 shiny brown bags, 3 dim magenta bags.",
"wavy aqua bags contain 2 light beige bags, 3 vibrant white bags, 2 vibrant gold bags, 5 shiny tomato bags.",
"clear white bags contain 3 dim maroon bags, 4 vibrant brown bags, 1 dim chartreuse bag.",
"muted yellow bags contain 3 shiny crimson bags, 4 posh purple bags, 2 dim plum bags, 3 shiny tomato bags.",
"faded cyan bags contain 5 mirrored crimson bags.",
"posh violet bags contain 3 dim lavender bags, 3 vibrant teal bags.",
"mirrored magenta bags contain 1 posh brown bag, 4 shiny teal bags, 2 shiny crimson bags.",
"mirrored purple bags contain 2 clear aqua bags.",
"wavy salmon bags contain 1 dull aqua bag, 1 dark silver bag.",
"plaid purple bags contain 2 clear aqua bags, 5 pale brown bags, 3 bright chartreuse bags.",
"posh teal bags contain 1 pale turquoise bag, 3 drab cyan bags.",
"pale tomato bags contain 2 dark beige bags.",
"muted plum bags contain 5 dotted gold bags, 5 shiny plum bags, 4 dull teal bags.",
"wavy red bags contain 3 clear turquoise bags, 4 shiny chartreuse bags, 4 dotted maroon bags.",
"wavy tomato bags contain 4 dark magenta bags, 1 faded bronze bag.",
"shiny green bags contain 3 bright black bags, 2 clear turquoise bags.",
"plaid turquoise bags contain 4 bright maroon bags.",
"vibrant silver bags contain 5 bright chartreuse bags, 2 posh white bags, 3 drab tomato bags.",
"posh olive bags contain 3 vibrant purple bags, 3 shiny crimson bags, 5 faded chartreuse bags.",
"clear bronze bags contain 5 dark magenta bags.",
"wavy teal bags contain 1 dim plum bag, 1 pale aqua bag, 2 posh purple bags, 2 pale orange bags.",
"muted beige bags contain 5 dotted brown bags, 4 mirrored green bags, 2 plaid blue bags.",
"shiny maroon bags contain 2 pale green bags.",
"wavy purple bags contain 5 dark bronze bags.",
"vibrant cyan bags contain 2 drab blue bags, 5 pale brown bags, 1 mirrored magenta bag, 4 pale orange bags.",
"wavy gray bags contain 5 pale crimson bags, 5 light aqua bags, 4 muted red bags.",
"clear tomato bags contain 4 dark coral bags.",
"shiny red bags contain 4 shiny tan bags, 4 pale cyan bags.",
"muted brown bags contain 5 dull olive bags, 2 pale silver bags, 5 faded plum bags.",
"shiny violet bags contain 4 wavy teal bags.",
"posh white bags contain 4 light fuchsia bags, 1 posh purple bag, 4 posh green bags.",
"dim maroon bags contain 5 dim gold bags, 1 clear black bag.",
"dull orange bags contain 1 clear teal bag, 3 dull gray bags.",
"posh fuchsia bags contain 1 faded gold bag, 4 light bronze bags.",
"dim bronze bags contain 1 bright fuchsia bag.",
"dull salmon bags contain 5 muted tomato bags, 3 dull olive bags, 4 dark brown bags.",
"posh yellow bags contain 5 dull indigo bags, 1 dotted green bag, 3 shiny chartreuse bags.",
"muted bronze bags contain 4 pale brown bags.",
"wavy plum bags contain 4 shiny teal bags, 4 vibrant crimson bags.",
"dark maroon bags contain 2 clear maroon bags, 3 light crimson bags.",
"posh gray bags contain 2 drab maroon bags, 3 dotted aqua bags.",
"pale maroon bags contain 2 vibrant turquoise bags, 2 wavy tan bags, 5 clear orange bags, 2 clear beige bags.",
"mirrored crimson bags contain 3 dark cyan bags, 3 dark silver bags.",
"shiny bronze bags contain 3 drab tomato bags, 3 vibrant tan bags.",
"pale teal bags contain 4 clear brown bags, 4 vibrant gray bags, 3 bright plum bags, 4 dull olive bags.",
"plaid maroon bags contain 1 mirrored blue bag, 4 bright chartreuse bags.",
"plaid blue bags contain 4 light lime bags.",
"dotted brown bags contain 5 shiny violet bags, 2 shiny lavender bags, 1 striped crimson bag.",
"pale purple bags contain 2 clear tomato bags, 5 vibrant orange bags, 5 dark green bags, 1 vibrant silver bag.",
"clear lavender bags contain 1 wavy cyan bag, 5 dotted crimson bags, 5 dark bronze bags, 3 light bronze bags.",
"light cyan bags contain 5 light lime bags, 1 mirrored teal bag.",
"dull blue bags contain 3 clear lime bags, 1 light turquoise bag, 1 shiny gray bag.",
"faded gray bags contain 2 faded crimson bags, 1 pale red bag, 3 striped bronze bags.",
"drab maroon bags contain 2 bright coral bags.",
"plaid gold bags contain 2 shiny gold bags, 1 wavy fuchsia bag, 2 dull aqua bags, 4 mirrored indigo bags.",
"mirrored orange bags contain 3 muted coral bags.",
"dull yellow bags contain 1 drab maroon bag, 4 posh purple bags, 5 plaid cyan bags, 4 vibrant cyan bags.",
"plaid aqua bags contain 2 bright silver bags, 2 posh blue bags, 3 drab olive bags, 2 mirrored fuchsia bags.",
"shiny olive bags contain 3 dim tan bags, 1 dark gray bag, 4 mirrored brown bags, 5 mirrored magenta bags.",
"wavy bronze bags contain 4 mirrored gray bags, 1 light lavender bag, 4 dull yellow bags.",
"dotted orange bags contain 1 plaid teal bag, 5 pale silver bags, 1 drab bronze bag.",
"dull magenta bags contain 1 muted violet bag, 2 muted black bags.",
"drab indigo bags contain 3 pale blue bags, 1 muted aqua bag, 3 bright fuchsia bags, 1 striped white bag.",
"faded turquoise bags contain 1 pale lavender bag, 1 shiny indigo bag.",
"shiny lavender bags contain 2 faded bronze bags, 3 clear green bags, 5 dim turquoise bags, 5 striped olive bags.",
"faded yellow bags contain 1 faded chartreuse bag.",
"vibrant gray bags contain 3 clear gold bags, 1 dotted coral bag, 4 light lime bags, 2 light lavender bags.",
"bright aqua bags contain 2 faded chartreuse bags.",
"bright yellow bags contain 4 dark blue bags.",
"mirrored tomato bags contain 2 posh blue bags.",
"shiny orange bags contain 3 striped black bags.",
"bright tan bags contain 3 dim gold bags.",
"light fuchsia bags contain 4 dotted bronze bags, 2 posh purple bags.",
"striped coral bags contain 2 mirrored fuchsia bags, 4 faded chartreuse bags, 3 dull brown bags.",
"bright cyan bags contain 3 mirrored lime bags, 2 posh purple bags, 3 light plum bags, 3 striped brown bags.",
"pale violet bags contain 3 wavy cyan bags.",
"bright lavender bags contain 2 shiny crimson bags, 1 plaid magenta bag, 4 dark turquoise bags.",
"wavy maroon bags contain 4 dull lavender bags, 2 dim turquoise bags, 2 light green bags, 1 clear lime bag.",
"drab tomato bags contain 1 light crimson bag, 5 faded gold bags, 5 drab cyan bags.",
"dotted magenta bags contain 1 dotted beige bag.",
"clear green bags contain 4 posh purple bags.",
"shiny teal bags contain 2 pale turquoise bags.",
"clear salmon bags contain 3 clear aqua bags.",
"dark gold bags contain 1 pale tan bag.",
"mirrored gray bags contain 1 muted purple bag.",
"vibrant indigo bags contain 3 muted coral bags, 5 shiny gray bags, 1 dark yellow bag.",
"pale olive bags contain 2 posh white bags, 3 dull white bags, 5 light silver bags.",
"bright bronze bags contain 3 dull yellow bags.",
"dark yellow bags contain 1 bright black bag, 1 clear teal bag.",
"dim cyan bags contain 4 wavy crimson bags, 4 muted green bags.",
"shiny blue bags contain 1 pale beige bag, 1 plaid magenta bag, 1 dark magenta bag, 3 dim tomato bags.",
"pale green bags contain 5 dotted crimson bags, 5 posh purple bags, 4 pale aqua bags, 2 faded tomato bags.",
"faded coral bags contain 1 striped maroon bag, 5 drab salmon bags, 5 muted orange bags, 1 dark blue bag.",
"light beige bags contain 3 light red bags, 1 mirrored red bag, 3 drab salmon bags, 2 wavy teal bags.",
"wavy yellow bags contain 2 clear coral bags, 2 pale turquoise bags.",
"dim lavender bags contain 2 dull silver bags, 3 dull gray bags, 2 wavy crimson bags.",
"dotted white bags contain 1 posh turquoise bag, 3 faded gold bags, 1 mirrored beige bag.",
"dotted red bags contain 2 plaid gray bags.",
"light black bags contain 3 faded chartreuse bags, 4 dark yellow bags, 5 plaid cyan bags.",
"vibrant black bags contain 2 faded fuchsia bags, 3 vibrant bronze bags, 3 dark brown bags, 5 bright purple bags.",
"plaid olive bags contain 2 faded gray bags, 1 wavy purple bag.",
"pale plum bags contain 3 pale tan bags, 1 posh coral bag, 2 dim fuchsia bags.",
"vibrant violet bags contain 1 clear coral bag.",
"mirrored indigo bags contain 1 faded violet bag.",
"posh lime bags contain 3 faded gray bags, 4 dim indigo bags, 1 wavy olive bag, 5 bright violet bags.",
"pale bronze bags contain 5 plaid gold bags.",
"shiny purple bags contain 3 dark silver bags, 5 dark aqua bags, 5 mirrored indigo bags, 3 plaid teal bags.",
"muted turquoise bags contain 4 clear teal bags.",
"light turquoise bags contain 2 muted coral bags, 2 clear beige bags, 3 clear maroon bags.",
"vibrant purple bags contain 4 dull aqua bags, 1 light crimson bag.",
"dotted yellow bags contain 2 wavy yellow bags.",
"bright salmon bags contain 5 striped coral bags, 4 dim red bags, 3 faded tan bags.",
"drab tan bags contain 2 clear yellow bags.",
"plaid violet bags contain 2 pale plum bags, 3 dim lavender bags, 5 clear tan bags.",
"dull tan bags contain 1 dotted aqua bag.",
"dotted blue bags contain 4 vibrant maroon bags, 4 drab tomato bags, 5 light bronze bags, 1 posh bronze bag.",
"light silver bags contain 5 vibrant purple bags.",
"muted blue bags contain 4 bright coral bags, 3 faded blue bags, 5 dull lime bags, 5 pale brown bags.",
"dotted lime bags contain 3 light aqua bags, 4 dull brown bags.",
"dotted aqua bags contain 1 mirrored fuchsia bag, 5 wavy cyan bags, 3 wavy tan bags.",
"faded lavender bags contain 4 shiny chartreuse bags, 4 faded violet bags, 2 striped tan bags.",
"bright violet bags contain 1 shiny gold bag, 5 pale beige bags, 2 pale orange bags, 3 wavy crimson bags.",
"striped turquoise bags contain 3 drab blue bags.",
"dim black bags contain 2 muted coral bags, 2 pale plum bags, 2 shiny teal bags.",
"striped violet bags contain 5 mirrored white bags, 2 striped coral bags.",
"pale gray bags contain 4 faded chartreuse bags, 2 vibrant aqua bags.",
"drab cyan bags contain 5 bright fuchsia bags.",
"wavy olive bags contain 3 striped beige bags.",
"faded aqua bags contain 4 vibrant teal bags, 1 dark olive bag, 1 bright crimson bag, 1 plaid indigo bag.",
"wavy blue bags contain 4 clear maroon bags, 4 dim cyan bags, 2 mirrored gray bags.",
"clear magenta bags contain 3 vibrant purple bags, 4 dotted maroon bags, 1 plaid green bag, 5 drab green bags.",
"faded olive bags contain 5 striped turquoise bags.",
"vibrant olive bags contain 2 shiny teal bags, 4 shiny maroon bags, 5 clear tomato bags.",
"muted red bags contain 3 dim magenta bags, 1 shiny teal bag.",
"bright indigo bags contain 5 muted red bags.",
"faded lime bags contain 5 posh maroon bags, 2 pale indigo bags, 2 posh turquoise bags, 5 dim indigo bags.",
"plaid fuchsia bags contain 2 dim fuchsia bags, 3 light aqua bags.",
"posh bronze bags contain 4 dull aqua bags.",
"striped green bags contain 1 dotted lime bag.",
"faded maroon bags contain 3 mirrored turquoise bags, 4 dark orange bags.",
"dim turquoise bags contain 2 drab cyan bags, 2 clear lime bags, 2 dim salmon bags.",
"bright gold bags contain 2 mirrored blue bags, 2 vibrant purple bags, 5 drab purple bags.",
"light red bags contain 1 drab fuchsia bag, 3 drab maroon bags, 5 dim plum bags, 5 pale red bags.",
"vibrant lime bags contain 3 dull chartreuse bags, 4 pale crimson bags, 5 dark orange bags, 3 vibrant purple bags.",
"pale magenta bags contain 2 vibrant purple bags, 4 wavy olive bags.",
"drab turquoise bags contain 5 dotted crimson bags.",
"posh beige bags contain 5 dark gray bags, 2 striped maroon bags, 3 muted red bags.",
"wavy gold bags contain 2 dull lavender bags, 1 dotted red bag, 1 drab tomato bag, 4 dark gray bags.",
"clear tan bags contain 5 dull gray bags, 2 wavy maroon bags, 2 pale red bags.",
"wavy green bags contain 5 pale magenta bags, 2 vibrant coral bags, 2 bright turquoise bags.",
"mirrored lavender bags contain 5 dotted beige bags.",
"clear beige bags contain 2 muted purple bags.",
"clear gray bags contain 5 shiny green bags, 3 plaid gold bags, 4 vibrant indigo bags, 1 pale brown bag.",
"mirrored lime bags contain 1 muted gray bag, 1 striped red bag, 5 plaid brown bags, 1 plaid black bag.",
"clear olive bags contain 1 posh olive bag, 1 striped bronze bag.",
"wavy lavender bags contain 3 mirrored green bags, 3 bright coral bags.",
"muted green bags contain 4 pale orange bags.",
"posh black bags contain 1 wavy bronze bag, 2 dim cyan bags.",
"posh purple bags contain no other bags.",
"wavy crimson bags contain 3 dim fuchsia bags, 5 dull chartreuse bags, 1 dark yellow bag.",
"bright lime bags contain 2 pale crimson bags, 2 drab green bags, 3 dull orange bags.",
"mirrored black bags contain 5 light beige bags, 1 striped olive bag, 2 plaid purple bags, 3 vibrant tan bags.",
"dull turquoise bags contain 5 striped violet bags, 3 striped lime bags, 4 pale black bags, 3 drab brown bags.",
"striped yellow bags contain 2 dark crimson bags, 1 clear fuchsia bag.",
"drab orange bags contain 3 shiny blue bags, 2 clear green bags, 2 muted plum bags.",
"light coral bags contain 3 mirrored fuchsia bags, 1 shiny tomato bag, 2 dull aqua bags, 2 muted yellow bags.",
"posh silver bags contain 1 light coral bag.",
"light tomato bags contain 1 faded silver bag.",
"dark turquoise bags contain 3 dull yellow bags, 4 posh turquoise bags.",
"dotted olive bags contain 2 clear bronze bags.",
"faded beige bags contain 5 posh teal bags, 2 drab beige bags, 3 plaid lavender bags, 4 drab purple bags.",
"drab lavender bags contain 4 faded gray bags, 2 pale blue bags, 4 faded gold bags, 3 dark silver bags.",
"faded salmon bags contain 5 light lavender bags.",
"drab crimson bags contain 3 drab aqua bags, 4 striped yellow bags, 2 shiny fuchsia bags, 4 dark olive bags.",
"clear brown bags contain 1 striped coral bag, 2 shiny gold bags.",
"wavy black bags contain 3 dull orange bags, 3 faded salmon bags, 2 plaid white bags.",
"faded brown bags contain 2 plaid cyan bags, 5 light lavender bags, 3 bright coral bags, 2 drab maroon bags.",
"vibrant yellow bags contain 4 striped bronze bags.",
"posh aqua bags contain 4 light crimson bags, 1 dark red bag, 4 bright lavender bags, 4 striped beige bags.",
"pale cyan bags contain 1 dark olive bag, 2 pale orange bags, 1 vibrant white bag.",
"muted white bags contain 1 light brown bag.",
"bright fuchsia bags contain 2 posh brown bags, 5 clear coral bags, 1 dim plum bag.",
"mirrored aqua bags contain 3 light fuchsia bags, 3 bright aqua bags, 2 light aqua bags.",
"wavy coral bags contain 2 muted yellow bags, 3 drab silver bags, 5 dark silver bags.",
"muted fuchsia bags contain 1 plaid black bag, 5 shiny yellow bags.",
"dim green bags contain 4 wavy aqua bags, 2 light cyan bags, 1 shiny gray bag.",
"drab black bags contain 2 dotted maroon bags, 5 clear maroon bags, 3 mirrored coral bags, 1 dim salmon bag.",
"shiny coral bags contain 4 light plum bags, 4 mirrored chartreuse bags, 3 wavy white bags.",
"posh indigo bags contain 2 dark cyan bags, 5 pale brown bags, 1 dull blue bag, 3 striped red bags.",
"pale brown bags contain 4 dull red bags, 4 shiny teal bags, 4 shiny crimson bags, 2 bright fuchsia bags.",
"plaid coral bags contain 1 dim maroon bag, 4 clear plum bags, 5 dark green bags, 4 shiny purple bags.",
"shiny gold bags contain 1 pale aqua bag, 3 dark cyan bags, 5 vibrant purple bags, 2 drab blue bags.",
"plaid brown bags contain 1 wavy crimson bag.",
"muted teal bags contain 2 drab turquoise bags, 2 clear tan bags, 4 shiny violet bags, 1 vibrant tan bag.",
"drab blue bags contain 2 bright fuchsia bags, 2 clear coral bags.",
"light olive bags contain 2 faded purple bags, 4 striped bronze bags.",
"drab yellow bags contain 5 shiny maroon bags, 4 clear teal bags, 5 wavy white bags.",
"clear blue bags contain 5 drab maroon bags, 2 shiny gold bags, 3 pale red bags, 3 dotted gold bags.",
"wavy brown bags contain 2 pale beige bags, 5 light yellow bags, 4 striped aqua bags, 3 wavy yellow bags.",
"dotted purple bags contain 2 dark teal bags, 5 posh brown bags, 4 plaid fuchsia bags, 2 posh silver bags.",
"mirrored turquoise bags contain 3 dim tan bags.",
"dotted cyan bags contain 3 shiny lavender bags, 5 clear aqua bags.",
"striped olive bags contain 4 dark cyan bags, 3 dim plum bags.",
"faded fuchsia bags contain 1 shiny indigo bag, 2 dull gold bags, 4 mirrored salmon bags.",
"pale gold bags contain 4 clear gold bags, 3 bright lime bags.",
"dull olive bags contain 4 striped chartreuse bags.",
"shiny tomato bags contain 4 shiny teal bags.",
"striped salmon bags contain 5 faded lavender bags, 1 dim aqua bag.",
"pale salmon bags contain 2 dim orange bags.",
"dim salmon bags contain 3 posh purple bags, 5 mirrored brown bags.",
"muted coral bags contain 4 light green bags, 3 striped turquoise bags, 2 plaid silver bags, 5 vibrant maroon bags.",
"dull bronze bags contain 2 dim magenta bags, 1 faded lavender bag.",
"drab gray bags contain 1 mirrored indigo bag, 1 pale crimson bag, 3 plaid teal bags.",
"muted chartreuse bags contain 5 light coral bags, 5 vibrant turquoise bags, 3 dark cyan bags, 5 bright orange bags.",
"mirrored green bags contain 2 bright purple bags, 4 posh bronze bags, 1 shiny violet bag, 5 clear teal bags.",
"bright orange bags contain 1 dull gray bag.",
"dim coral bags contain 1 posh salmon bag, 2 striped salmon bags, 3 striped chartreuse bags.",
"clear turquoise bags contain 3 wavy salmon bags, 1 clear blue bag, 1 drab tan bag.",
"bright teal bags contain 1 faded tan bag, 5 striped teal bags, 3 light lavender bags, 2 dark olive bags.",
"shiny chartreuse bags contain 2 dull blue bags, 5 drab turquoise bags, 4 light aqua bags.",
"faded tan bags contain 4 drab purple bags.",
"plaid magenta bags contain 5 drab cyan bags, 4 muted aqua bags.",
"muted purple bags contain no other bags.",
"vibrant green bags contain 5 striped crimson bags, 5 clear beige bags, 3 drab yellow bags.",
"vibrant salmon bags contain 4 clear red bags, 5 wavy salmon bags.",
"vibrant tomato bags contain 3 light plum bags, 1 posh white bag, 2 wavy magenta bags.",
"wavy turquoise bags contain 5 dotted gold bags, 2 light gray bags, 4 drab tomato bags, 5 wavy aqua bags.",
"dim olive bags contain 3 light magenta bags, 1 dotted lime bag, 4 dotted crimson bags, 3 light salmon bags.",
"plaid lavender bags contain 2 dark turquoise bags, 5 striped turquoise bags, 4 wavy olive bags.",
"dark green bags contain 3 dotted gold bags.",
"faded purple bags contain 5 clear coral bags, 3 mirrored green bags, 5 drab coral bags, 3 bright purple bags.",
"dotted crimson bags contain 2 wavy teal bags, 5 light green bags, 5 muted purple bags, 1 plaid silver bag.",
"mirrored coral bags contain 5 striped turquoise bags, 1 faded purple bag, 1 shiny cyan bag.",
"mirrored cyan bags contain 1 mirrored chartreuse bag, 5 wavy magenta bags.",
"shiny black bags contain 2 drab magenta bags, 2 plaid bronze bags.",
"dark teal bags contain 3 dark white bags, 1 muted chartreuse bag, 3 dotted salmon bags, 4 posh aqua bags.",
"dull teal bags contain 2 bright chartreuse bags, 3 light black bags.",
"mirrored red bags contain 2 dotted crimson bags, 2 drab cyan bags.",
"striped brown bags contain 2 pale red bags, 5 light gray bags.",
"posh magenta bags contain 4 posh green bags, 4 dotted bronze bags, 5 dim tan bags.",
"pale lime bags contain 5 shiny blue bags.",
"plaid indigo bags contain 3 shiny maroon bags, 1 dark yellow bag, 4 dull gold bags.",
"light green bags contain 2 dull brown bags, 5 bright coral bags.",
"muted olive bags contain 3 dotted bronze bags, 1 shiny coral bag, 3 dotted aqua bags, 2 faded blue bags.",
"striped lime bags contain 2 faded salmon bags, 2 pale white bags, 1 plaid salmon bag, 1 dark coral bag.",
"clear red bags contain 3 dark orange bags, 5 faded magenta bags, 4 dark lime bags.",
"faded bronze bags contain 4 light lavender bags.",
"dotted plum bags contain 1 faded tan bag, 3 pale aqua bags, 2 dull gray bags, 4 plaid purple bags.",
"plaid salmon bags contain 5 light lime bags, 1 posh bronze bag, 5 wavy magenta bags, 1 dark green bag.",
"dull plum bags contain 4 mirrored purple bags.",
"light indigo bags contain 3 dark silver bags, 1 bright lime bag.",
"pale red bags contain 5 posh purple bags.",
"wavy chartreuse bags contain 1 light coral bag.",
"dull lavender bags contain 5 plaid purple bags, 4 faded orange bags.",
"vibrant orange bags contain 2 drab violet bags.",
"light gold bags contain 3 plaid salmon bags.",
"faded teal bags contain 1 dotted maroon bag.",
"light chartreuse bags contain 3 dotted yellow bags, 1 clear yellow bag, 3 shiny teal bags, 4 plaid lime bags.",
"faded white bags contain 5 drab turquoise bags, 1 dark violet bag.",
"light lavender bags contain 1 vibrant magenta bag, 1 pale brown bag.",
"light crimson bags contain 5 dull red bags.",
"mirrored silver bags contain 2 bright turquoise bags.",
"faded green bags contain 5 dark lime bags, 5 dim crimson bags, 4 dark silver bags, 1 dotted white bag.",
"vibrant chartreuse bags contain 5 wavy gray bags, 5 bright silver bags, 1 dull indigo bag.",
"clear chartreuse bags contain 5 light brown bags, 2 dim violet bags, 4 faded orange bags.",
"dotted violet bags contain 4 dark white bags, 1 muted brown bag, 4 faded cyan bags, 5 striped gray bags.",
"dotted green bags contain 5 bright silver bags, 4 drab lime bags.",
"light bronze bags contain 3 dotted gold bags.",
"vibrant tan bags contain 2 dull chartreuse bags, 5 clear gold bags, 1 bright orange bag, 2 dotted gold bags.",
"faded gold bags contain 4 shiny gold bags, 1 dark red bag, 2 dotted bronze bags, 1 muted red bag.",
"plaid green bags contain 4 light gray bags, 1 striped bronze bag.",
"clear yellow bags contain 4 drab blue bags.",
"mirrored yellow bags contain 3 vibrant tan bags, 2 light crimson bags, 1 light lime bag, 5 bright teal bags.",
"dotted beige bags contain 2 pale beige bags, 3 light lime bags, 3 drab cyan bags, 3 plaid green bags.",
"pale chartreuse bags contain 1 striped brown bag, 2 faded gold bags.",
"wavy white bags contain 4 dotted gold bags, 5 striped turquoise bags, 1 mirrored chartreuse bag.",
"muted tomato bags contain 5 dark magenta bags.",
"dark lavender bags contain 4 pale indigo bags, 5 shiny cyan bags.",
"pale black bags contain 3 clear tomato bags, 3 vibrant gray bags.",
"dim orange bags contain 5 dark olive bags, 1 vibrant silver bag, 3 plaid brown bags, 1 dull red bag.",
"bright plum bags contain 5 striped tomato bags, 2 dotted beige bags.",
"posh tomato bags contain 5 faded tomato bags.",
"vibrant maroon bags contain 5 dark orange bags.",
"dim tan bags contain 5 muted yellow bags.",
"dotted tan bags contain 4 dark lime bags.",
"plaid red bags contain 2 posh beige bags, 3 wavy tan bags, 1 muted silver bag.",
"faded black bags contain 1 clear lavender bag, 4 dotted lime bags, 3 mirrored crimson bags, 2 faded gray bags.",
"mirrored tan bags contain 2 vibrant white bags, 5 mirrored beige bags, 4 wavy turquoise bags, 4 striped green bags.",
"dull violet bags contain 5 bright teal bags.",
"striped maroon bags contain 2 dull brown bags.",
"dull green bags contain 4 dim yellow bags, 3 mirrored silver bags, 5 muted chartreuse bags.",
"dull gray bags contain 3 vibrant purple bags, 3 striped turquoise bags, 5 wavy cyan bags.",
"posh salmon bags contain 4 light green bags, 4 dull blue bags.",
"dark tan bags contain 5 muted bronze bags, 5 clear lime bags, 5 vibrant gray bags.",
"dark purple bags contain 1 clear cyan bag, 3 vibrant tan bags, 5 light magenta bags, 1 dark blue bag.",
"plaid teal bags contain 1 wavy purple bag, 4 mirrored crimson bags.",
"posh brown bags contain no other bags.",
"pale orange bags contain no other bags.",
"posh plum bags contain 3 light bronze bags, 3 bright coral bags, 3 shiny yellow bags, 3 dark yellow bags.",
"bright olive bags contain 2 light silver bags.",
"posh red bags contain 4 dark turquoise bags, 1 plaid cyan bag, 3 dotted aqua bags.",
"muted violet bags contain 3 pale green bags, 5 dull red bags.",
"plaid crimson bags contain 3 clear silver bags.",
"dotted gray bags contain 1 muted white bag.",
"dull brown bags contain 1 dull aqua bag, 4 bright coral bags, 5 shiny violet bags, 1 light coral bag.",
"pale silver bags contain 3 mirrored brown bags, 2 dark brown bags, 2 vibrant indigo bags.",
"vibrant coral bags contain 2 pale red bags, 3 bright teal bags, 5 striped bronze bags, 1 bright silver bag.",
"dark brown bags contain 1 pale brown bag, 1 drab beige bag, 4 mirrored chartreuse bags, 1 clear teal bag.",
"dotted turquoise bags contain 4 wavy chartreuse bags, 2 faded violet bags.",
"bright silver bags contain 3 dark silver bags, 5 clear aqua bags, 1 striped coral bag, 4 vibrant violet bags.",
"plaid chartreuse bags contain 3 pale red bags, 4 wavy teal bags, 3 dark tomato bags.",
"bright red bags contain 4 pale red bags.",
"pale beige bags contain 3 posh purple bags, 2 striped gold bags.",
"vibrant plum bags contain 3 posh green bags, 5 plaid cyan bags, 4 light silver bags.",
"bright white bags contain 3 dull gold bags, 5 striped turquoise bags, 2 bright tan bags.",
"dark magenta bags contain 1 pale aqua bag, 5 faded bronze bags, 3 dark orange bags, 3 dim magenta bags.",
"bright beige bags contain 4 clear white bags, 2 dotted plum bags, 2 light brown bags, 1 plaid gray bag.",
"bright black bags contain 2 pale turquoise bags, 5 mirrored brown bags, 1 mirrored magenta bag, 4 dull lime bags.",
"bright gray bags contain 3 mirrored red bags, 5 clear brown bags, 4 muted violet bags.",
"muted magenta bags contain 1 posh bronze bag, 5 mirrored brown bags, 1 clear crimson bag, 1 light lavender bag.",
"light teal bags contain 4 shiny tan bags.",
"dark gray bags contain 4 dotted bronze bags, 2 pale red bags, 3 pale brown bags, 5 dim magenta bags.",
"muted black bags contain 5 light beige bags, 1 dark tomato bag, 3 striped coral bags, 3 vibrant maroon bags.",
"dark red bags contain 5 muted red bags, 3 dull lime bags, 2 shiny tomato bags, 2 pale brown bags.",
"bright brown bags contain 4 bright teal bags, 3 plaid green bags.",
"plaid yellow bags contain 4 plaid bronze bags.",
"dark cyan bags contain 2 dim plum bags, 4 shiny brown bags.",
"faded blue bags contain 4 faded yellow bags.",
"dull maroon bags contain 3 mirrored purple bags, 2 faded silver bags, 5 pale silver bags.",
"posh coral bags contain 5 dim gold bags.",
"faded chartreuse bags contain 2 clear coral bags, 5 dim gold bags.",
"striped silver bags contain 4 faded cyan bags, 5 wavy brown bags, 5 bright tan bags, 3 drab chartreuse bags.",
"plaid gray bags contain 4 faded tomato bags, 4 dim cyan bags, 4 dotted maroon bags, 5 clear indigo bags.",
"plaid white bags contain 4 dim magenta bags, 4 pale red bags.",
"dark black bags contain 1 drab tan bag, 4 striped indigo bags.",
"vibrant white bags contain 1 dull aqua bag, 3 dull red bags.",
"muted maroon bags contain 3 dim violet bags, 3 faded orange bags, 1 bright purple bag, 2 dull cyan bags.",
"pale indigo bags contain 3 faded plum bags, 3 clear tomato bags.",
"clear teal bags contain 1 light coral bag, 5 faded bronze bags, 5 faded chartreuse bags, 2 striped olive bags.",
"muted tan bags contain 3 bright cyan bags.",
"light magenta bags contain 5 dark magenta bags, 3 striped brown bags.",
"dark aqua bags contain 3 posh turquoise bags, 4 pale fuchsia bags, 2 bright orange bags, 4 dim cyan bags.",
"bright tomato bags contain 5 wavy bronze bags, 4 clear magenta bags, 4 shiny fuchsia bags.",
"dark salmon bags contain 4 pale indigo bags, 4 wavy magenta bags.",
"dim blue bags contain 4 pale magenta bags, 2 muted tomato bags.",
"dark blue bags contain 4 shiny tomato bags.",
"drab aqua bags contain 5 clear cyan bags, 1 dotted orange bag.",
"plaid tomato bags contain 2 clear red bags, 2 dark tomato bags, 2 bright gold bags.",
"vibrant crimson bags contain 3 dull blue bags.",
"light yellow bags contain 2 striped black bags, 2 shiny brown bags, 5 clear black bags.",
"pale white bags contain 1 posh plum bag.",
"dull gold bags contain 5 wavy crimson bags, 5 pale aqua bags, 5 mirrored cyan bags, 2 drab tomato bags.",
"striped gray bags contain 5 shiny tomato bags, 3 mirrored brown bags, 1 posh brown bag.",
"drab salmon bags contain 5 vibrant yellow bags.",
"light purple bags contain 1 shiny turquoise bag.",
"striped lavender bags contain 4 mirrored gold bags, 3 vibrant brown bags, 3 wavy bronze bags, 2 pale black bags.",
"vibrant beige bags contain 2 light yellow bags.",
"striped magenta bags contain 4 light black bags.",
"clear aqua bags contain 2 dark cyan bags, 1 faded orange bag, 3 mirrored gray bags, 2 dark tomato bags.",
"dim teal bags contain 2 dark gray bags.",
"striped tomato bags contain 4 dark coral bags, 1 faded blue bag.",
"striped gold bags contain 4 bright coral bags, 1 shiny teal bag, 4 dark silver bags.",
"light maroon bags contain 4 dotted coral bags.",
"pale blue bags contain 2 striped coral bags, 1 vibrant white bag, 3 drab maroon bags.",
"clear crimson bags contain 3 plaid chartreuse bags, 1 pale bronze bag.",
"dim beige bags contain 5 drab tan bags.",
"pale turquoise bags contain no other bags.",
"dotted salmon bags contain 2 clear magenta bags, 4 pale silver bags.",
"posh orange bags contain 3 dull aqua bags, 3 vibrant gray bags, 4 dull olive bags, 1 mirrored magenta bag.",
"dark tomato bags contain 3 shiny lavender bags, 2 drab beige bags, 3 dark cyan bags.",
"shiny aqua bags contain 3 light maroon bags, 4 muted turquoise bags, 2 vibrant magenta bags.",
"bright purple bags contain 3 light silver bags, 3 mirrored magenta bags.",
"shiny lime bags contain 3 dark olive bags, 1 striped chartreuse bag, 1 muted green bag.",
"bright crimson bags contain 2 muted indigo bags.",
"clear silver bags contain 3 mirrored red bags.",
"bright coral bags contain 1 dim gold bag, 2 clear green bags, 3 dark cyan bags.",
"pale crimson bags contain 4 shiny teal bags, 5 drab maroon bags, 1 pale brown bag.",
"wavy silver bags contain 2 dotted cyan bags, 1 vibrant silver bag, 2 light turquoise bags, 3 light salmon bags.",
"muted salmon bags contain 1 shiny bronze bag, 5 faded salmon bags, 4 muted black bags, 1 muted coral bag.",
"drab teal bags contain 2 vibrant violet bags, 4 vibrant orange bags.",
"mirrored blue bags contain 3 mirrored fuchsia bags.",
"mirrored white bags contain 4 striped brown bags, 5 mirrored cyan bags.",
"dull coral bags contain 2 bright magenta bags, 5 clear tan bags.",
"dull aqua bags contain 3 dim magenta bags, 2 light lavender bags.",
"faded crimson bags contain 4 striped maroon bags, 4 dull lime bags, 5 vibrant magenta bags.",
"light blue bags contain 1 plaid gold bag, 5 plaid white bags, 1 plaid black bag.",
"pale tan bags contain 3 posh green bags, 1 dim fuchsia bag, 5 vibrant yellow bags.",
"vibrant blue bags contain 4 pale gold bags, 1 clear magenta bag.",
"vibrant red bags contain 1 plaid cyan bag, 2 dim tan bags, 1 muted red bag.",
"striped cyan bags contain 5 plaid blue bags, 3 faded lavender bags.",
"dull silver bags contain 2 dark bronze bags, 5 pale orange bags.",
"striped bronze bags contain 1 shiny tomato bag, 4 muted yellow bags, 4 striped turquoise bags.",
"light aqua bags contain 5 shiny violet bags.",
"drab white bags contain 5 faded gold bags, 1 striped tomato bag, 1 plaid salmon bag.",
"clear lime bags contain 4 mirrored brown bags, 2 light lavender bags, 1 light coral bag.",
"shiny tan bags contain 4 bright fuchsia bags, 1 dark orange bag, 1 dull lime bag.",
"bright turquoise bags contain 1 dim salmon bag, 3 light green bags, 3 shiny crimson bags, 2 wavy cyan bags.",
"posh lavender bags contain 1 bright bronze bag, 2 dull lavender bags, 1 vibrant purple bag, 5 shiny violet bags.",
"wavy indigo bags contain 2 striped violet bags, 1 mirrored red bag, 1 muted turquoise bag.",
"dull cyan bags contain 5 vibrant yellow bags, 2 wavy salmon bags, 2 striped olive bags, 5 vibrant turquoise bags.",
"posh maroon bags contain 2 clear bronze bags, 3 vibrant tan bags.",
"faded violet bags contain 4 shiny olive bags, 3 posh magenta bags.",
"striped blue bags contain 4 dull tomato bags, 3 bright plum bags.",
"mirrored teal bags contain 4 dark crimson bags, 5 dotted coral bags, 2 clear indigo bags, 5 faded salmon bags.",
"bright magenta bags contain 4 clear turquoise bags, 5 dim turquoise bags.",
"vibrant magenta bags contain 5 mirrored magenta bags, 2 clear green bags.",
"clear cyan bags contain 4 pale turquoise bags, 3 wavy maroon bags.",
"striped beige bags contain 5 mirrored magenta bags, 4 clear fuchsia bags.",
"light white bags contain 4 pale brown bags, 3 vibrant plum bags.",
"shiny silver bags contain 5 striped gray bags, 3 drab silver bags, 3 shiny beige bags, 4 wavy salmon bags.",
"drab magenta bags contain 5 dark brown bags, 4 shiny fuchsia bags.",
"dark white bags contain 5 posh fuchsia bags, 4 shiny turquoise bags, 1 vibrant cyan bag.",
"dim red bags contain 1 bright tan bag.",
"posh crimson bags contain 5 bright gray bags.",
"plaid silver bags contain 4 muted purple bags, 5 faded gold bags.",
"dull indigo bags contain 5 dim violet bags, 5 light maroon bags.",
"dotted fuchsia bags contain 4 pale yellow bags, 5 dim gold bags, 2 bright fuchsia bags.",
"light lime bags contain 4 striped aqua bags, 4 shiny tan bags, 2 striped bronze bags, 4 dotted lime bags.",
"dark crimson bags contain 2 dim turquoise bags.",
"plaid bronze bags contain 3 posh red bags, 4 mirrored silver bags, 2 drab tan bags.",
"dark plum bags contain 1 pale coral bag, 4 clear cyan bags, 5 dim turquoise bags, 4 striped crimson bags.",
"mirrored maroon bags contain 5 clear chartreuse bags, 2 pale purple bags, 5 clear fuchsia bags.",
"drab fuchsia bags contain 2 shiny olive bags, 5 wavy salmon bags, 5 drab lime bags.",
"bright chartreuse bags contain 5 bright turquoise bags, 3 bright fuchsia bags.",
"dim indigo bags contain 4 wavy chartreuse bags, 3 light coral bags, 1 clear fuchsia bag, 2 faded violet bags.",
"vibrant brown bags contain 4 mirrored silver bags, 4 bright bronze bags, 3 plaid purple bags.",
"striped black bags contain 3 shiny fuchsia bags.",
"wavy orange bags contain 3 clear maroon bags, 5 drab magenta bags.",
"striped indigo bags contain 4 striped teal bags, 5 dull lavender bags, 1 muted red bag, 3 wavy blue bags.",
"dark bronze bags contain 3 clear beige bags, 4 drab cyan bags.",
"striped crimson bags contain 1 plaid cyan bag.",
"light salmon bags contain 5 pale yellow bags, 2 plaid purple bags, 4 dark indigo bags, 3 striped white bags.",
"dotted indigo bags contain 3 mirrored magenta bags, 5 striped gold bags, 3 clear coral bags, 2 wavy olive bags.",
"muted gold bags contain 3 wavy violet bags, 1 wavy purple bag, 2 dim gold bags.",
"clear orange bags contain 1 striped turquoise bag, 3 posh turquoise bags, 3 light plum bags, 3 pale crimson bags.",
"faded magenta bags contain 1 drab blue bag, 2 plaid green bags.",
"dark orange bags contain 4 drab tomato bags, 4 mirrored brown bags, 1 mirrored fuchsia bag, 1 dim magenta bag.",
"pale fuchsia bags contain 1 clear lime bag.",
"dotted teal bags contain 1 dull fuchsia bag.",
"drab silver bags contain 4 pale red bags, 4 clear chartreuse bags.",
"clear gold bags contain 4 pale crimson bags.",
"dotted bronze bags contain 4 mirrored brown bags, 2 dull red bags, 1 shiny tomato bag.",
"shiny brown bags contain no other bags.",
"pale yellow bags contain 2 mirrored brown bags, 5 clear fuchsia bags.",
"dull chartreuse bags contain 4 posh magenta bags, 3 mirrored magenta bags.",
"dim silver bags contain 3 faded coral bags.",
"dull purple bags contain 1 light blue bag, 5 dark fuchsia bags, 5 faded lavender bags, 3 posh maroon bags.",
"light violet bags contain 5 dim olive bags.",
"wavy fuchsia bags contain 1 shiny olive bag, 4 drab cyan bags.",
"muted aqua bags contain 1 shiny teal bag, 1 dull lime bag, 5 faded tomato bags, 5 bright fuchsia bags.",
"striped orange bags contain 5 mirrored beige bags.",
"faded orange bags contain 2 wavy yellow bags, 2 bright fuchsia bags, 3 posh purple bags.",
"dotted lavender bags contain 5 dark blue bags, 3 faded black bags, 4 bright indigo bags.",
"wavy tan bags contain 3 plaid chartreuse bags, 1 clear gold bag.",
"clear indigo bags contain 4 striped olive bags, 3 mirrored brown bags.",
"light plum bags contain 3 mirrored indigo bags.",
"striped tan bags contain 2 vibrant cyan bags, 4 dull lime bags, 2 dim indigo bags.",
"plaid cyan bags contain 1 dim turquoise bag, 5 clear lime bags, 1 muted yellow bag, 3 shiny brown bags.",
"drab gold bags contain 1 pale red bag, 4 shiny purple bags.",
"drab violet bags contain 5 vibrant lime bags, 3 vibrant aqua bags.",
"dim gold bags contain 5 dull lime bags, 3 bright fuchsia bags, 1 muted yellow bag.",
"muted cyan bags contain 1 mirrored black bag, 2 clear orange bags, 5 light crimson bags, 2 mirrored teal bags.",
"dotted tomato bags contain 1 dotted bronze bag, 1 dark orange bag, 4 vibrant maroon bags, 5 drab tomato bags.",
"striped chartreuse bags contain 4 mirrored fuchsia bags, 5 dim magenta bags.",
"muted silver bags contain 1 vibrant turquoise bag, 1 clear teal bag, 3 bright black bags.",
"dim purple bags contain 2 light gray bags, 2 dull aqua bags, 1 pale turquoise bag, 3 dim gold bags.",
"drab red bags contain 4 drab magenta bags.",
"muted indigo bags contain 4 light plum bags, 1 striped beige bag.",
"dark olive bags contain 4 striped gold bags.",
"clear violet bags contain 5 vibrant white bags, 1 wavy bronze bag, 3 light plum bags, 1 dark yellow bag.",
"striped aqua bags contain 3 dim salmon bags, 3 light aqua bags.",
"bright maroon bags contain 4 shiny fuchsia bags, 5 faded tomato bags, 1 clear white bag, 4 wavy yellow bags.",
"dark beige bags contain 4 faded blue bags, 4 vibrant bronze bags, 2 dark magenta bags.",
"posh turquoise bags contain 4 pale red bags, 3 mirrored brown bags, 3 mirrored indigo bags, 3 striped gold bags.",
"drab purple bags contain 5 light green bags, 1 shiny gold bag, 2 striped turquoise bags, 5 mirrored beige bags.",
"bright blue bags contain 5 dim indigo bags, 2 dotted crimson bags, 1 bright aqua bag, 5 clear silver bags.",
"posh blue bags contain 2 shiny maroon bags, 3 striped bronze bags.",
"wavy beige bags contain 1 dotted white bag, 3 striped aqua bags, 3 drab yellow bags.",
"dotted chartreuse bags contain 5 dotted bronze bags.",
"shiny gray bags contain 2 dim magenta bags.",
"mirrored beige bags contain 3 clear coral bags, 3 dim salmon bags.",
"faded tomato bags contain 2 bright black bags, 5 shiny tomato bags, 3 mirrored brown bags, 5 dull lime bags.",
"drab brown bags contain 5 clear black bags.",
"clear black bags contain 4 faded blue bags, 4 posh turquoise bags, 4 pale green bags, 4 faded crimson bags.",
"vibrant aqua bags contain 2 faded bronze bags, 3 dull aqua bags, 1 clear beige bag, 2 light lavender bags.",
"drab green bags contain 3 drab blue bags, 2 pale red bags, 2 posh green bags.",
"wavy cyan bags contain 4 faded blue bags, 2 faded chartreuse bags, 2 pale crimson bags.",
"plaid orange bags contain 1 muted yellow bag, 5 dull chartreuse bags, 5 dull gray bags, 3 pale crimson bags.",
"dark lime bags contain 4 clear brown bags, 1 drab fuchsia bag, 1 light aqua bag, 4 wavy tan bags.",
"dark violet bags contain 3 vibrant lime bags, 3 clear fuchsia bags.",
"plaid beige bags contain 2 dark teal bags, 2 posh indigo bags, 4 mirrored red bags, 3 vibrant gold bags.",
"striped fuchsia bags contain 1 dim tan bag, 4 dotted plum bags, 5 plaid olive bags.",
"pale aqua bags contain 4 shiny tomato bags, 3 bright black bags.",
"shiny magenta bags contain 5 plaid blue bags, 2 pale maroon bags, 2 dim lavender bags.",
"dotted black bags contain 2 shiny aqua bags, 2 dim crimson bags, 2 plaid red bags, 5 bright black bags.",
"clear coral bags contain no other bags.",
"shiny yellow bags contain 2 clear silver bags, 1 vibrant cyan bag, 3 striped crimson bags, 5 light aqua bags.",
"dull beige bags contain 3 light green bags.",
"drab beige bags contain 4 bright black bags, 4 light silver bags, 4 light lavender bags.",
"shiny salmon bags contain 2 light blue bags, 1 pale yellow bag.",
"pale lavender bags contain 2 shiny maroon bags, 5 posh tan bags.",
"muted crimson bags contain 1 clear aqua bag, 2 posh turquoise bags.",
"dim gray bags contain 4 pale tomato bags, 2 dark chartreuse bags, 4 clear red bags.",
"faded silver bags contain 2 drab beige bags, 3 faded tomato bags, 4 dull gold bags, 2 mirrored magenta bags.",
"light gray bags contain 5 dark yellow bags.",
"dotted gold bags contain 1 light plum bag, 2 faded tomato bags.",
"drab chartreuse bags contain 4 vibrant indigo bags.",
"dim tomato bags contain 5 clear gold bags, 4 light gray bags, 4 shiny green bags, 5 faded yellow bags.",
"dull fuchsia bags contain 3 vibrant cyan bags, 1 dim plum bag, 5 posh bronze bags, 1 shiny crimson bag.",
"shiny cyan bags contain 5 striped red bags, 5 dim plum bags, 2 striped turquoise bags.",
"dim yellow bags contain 1 dull chartreuse bag.",
"wavy magenta bags contain 2 dull lime bags, 2 mirrored chartreuse bags, 2 faded bronze bags.",
"posh tan bags contain 5 shiny tomato bags, 5 drab maroon bags, 5 vibrant maroon bags.",
"vibrant gold bags contain 1 dark orange bag, 2 mirrored cyan bags, 1 vibrant cyan bag, 2 posh coral bags.",
"vibrant fuchsia bags contain 2 vibrant violet bags.",
"muted orange bags contain 3 striped gold bags, 1 posh green bag, 3 vibrant purple bags.",
"mirrored violet bags contain 4 clear chartreuse bags, 4 dotted yellow bags, 2 faded orange bags.",
"drab lime bags contain 1 mirrored magenta bag, 1 striped turquoise bag.",
"dotted silver bags contain 2 dark cyan bags, 5 drab olive bags.",
"dull crimson bags contain 3 clear yellow bags, 3 vibrant cyan bags, 1 bright turquoise bag.",
"light brown bags contain 4 shiny brown bags, 1 plaid fuchsia bag.",
"vibrant teal bags contain 2 mirrored aqua bags, 5 plaid silver bags.",
"vibrant turquoise bags contain 2 clear beige bags.",
"vibrant lavender bags contain 2 shiny teal bags, 5 shiny blue bags, 2 dull gray bags, 1 muted crimson bag.",
"bright green bags contain 1 dull silver bag, 1 dull red bag, 4 vibrant indigo bags, 2 clear coral bags.",
"mirrored bronze bags contain 5 dotted lavender bags, 2 muted tomato bags, 4 pale fuchsia bags, 4 dim black bags.",
"mirrored chartreuse bags contain 4 dark gray bags, 3 bright coral bags.",
"dull black bags contain 2 dim turquoise bags, 4 drab maroon bags, 4 shiny crimson bags.",
"shiny white bags contain 4 drab chartreuse bags, 4 plaid salmon bags, 1 dim green bag, 2 muted orange bags.",
"dim chartreuse bags contain 3 dim bronze bags, 5 posh lavender bags, 4 drab bronze bags.",
"mirrored olive bags contain 5 striped brown bags, 4 dim indigo bags.",
"muted lavender bags contain 3 dull teal bags, 4 mirrored lime bags.",
"striped teal bags contain 3 shiny coral bags.",
"shiny indigo bags contain 1 dark bronze bag, 2 light lavender bags, 4 faded violet bags, 4 drab green bags.",
"dim brown bags contain 5 dull aqua bags, 2 plaid indigo bags.",
"light tan bags contain 1 muted yellow bag.",
"dim violet bags contain 2 dim magenta bags, 5 shiny olive bags, 1 wavy fuchsia bag, 5 dull aqua bags.",
"dim crimson bags contain 2 faded bronze bags.",
"dull lime bags contain no other bags.",
"plaid black bags contain 2 clear beige bags, 5 faded tomato bags, 1 muted red bag.",
"clear maroon bags contain 3 muted coral bags.",
"faded red bags contain 2 posh purple bags, 4 plaid gold bags, 1 bright violet bag, 3 shiny coral bags.",
"dotted coral bags contain 4 pale tan bags.",
"dull red bags contain 3 shiny teal bags.",
"mirrored brown bags contain no other bags.",
"drab olive bags contain 2 light fuchsia bags, 1 dark brown bag, 2 shiny olive bags.",
"shiny plum bags contain 3 striped olive bags, 1 mirrored brown bag, 5 faded blue bags, 4 dark bronze bags.",
"plaid plum bags contain 3 shiny orange bags, 5 dim magenta bags, 2 bright crimson bags.",
"drab bronze bags contain 4 posh brown bags, 3 dotted maroon bags.",
"striped white bags contain 1 bright lime bag.",
"drab coral bags contain 1 mirrored beige bag, 4 plaid green bags, 2 drab turquoise bags, 1 drab bronze bag.",
"vibrant bronze bags contain 1 muted aqua bag, 3 posh brown bags, 5 light crimson bags.",
"dotted maroon bags contain 2 shiny tomato bags, 5 dark cyan bags.",
"striped plum bags contain 4 dark fuchsia bags, 4 dotted indigo bags.",
"faded indigo bags contain 4 dim orange bags, 2 vibrant crimson bags, 3 bright silver bags.",
"dim magenta bags contain 1 pale red bag, 1 faded tomato bag, 3 muted aqua bags.",
"muted lime bags contain 1 wavy magenta bag.",
"drab plum bags contain 1 striped green bag.",
"mirrored plum bags contain 1 bright gray bag, 4 shiny tomato bags, 1 mirrored salmon bag, 3 shiny black bags.",
"dim lime bags contain 3 wavy orange bags, 1 dark orange bag, 5 vibrant indigo bags.",
"faded plum bags contain 2 shiny yellow bags, 5 dark red bags, 1 plaid bronze bag.",
"shiny beige bags contain 2 striped beige bags.",
"clear plum bags contain 5 vibrant violet bags, 2 vibrant silver bags, 5 dark magenta bags, 4 posh lime bags.",
"pale coral bags contain 1 dotted lime bag, 3 vibrant bronze bags.",
"dark fuchsia bags contain 2 striped turquoise bags, 2 muted gray bags, 5 dotted turquoise bags, 2 dim black bags.",
"wavy violet bags contain 5 clear fuchsia bags, 4 shiny fuchsia bags.",
"wavy lime bags contain 4 plaid yellow bags, 1 striped bronze bag, 3 shiny cyan bags, 5 vibrant teal bags.",
"dark coral bags contain 5 drab lime bags, 1 light brown bag, 3 pale blue bags.",
"posh cyan bags contain 3 pale crimson bags, 5 wavy gray bags, 5 mirrored silver bags, 3 wavy violet bags.",
"posh gold bags contain 4 plaid indigo bags, 2 mirrored fuchsia bags, 1 striped gold bag.",
"light orange bags contain 4 light coral bags, 4 shiny indigo bags.",
"mirrored salmon bags contain 5 vibrant violet bags, 1 drab purple bag, 5 dark cyan bags.",
"posh green bags contain 1 light crimson bag, 3 vibrant cyan bags, 2 shiny brown bags, 2 vibrant magenta bags.",
"muted gray bags contain 5 plaid chartreuse bags.",
]


# x = [
# "light red bags contain 1 bright white bag, 2 muted yellow bags.",
# "dark orange bags contain 3 bright white bags, 4 muted yellow bags.",
# "bright white bags contain 1 shiny gold bag.",
# "muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.",
# "shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.",
# "dark olive bags contain 3 faded blue bags, 4 dotted black bags.",
# "vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.",
# "faded blue bags contain no other bags.",
# "dotted black bags contain no other bags.",
# ]

# x = [
# "shiny gold bags contain 2 dark red bags.",
# "dark red bags contain 2 dark orange bags.",
# "dark orange bags contain 2 dark yellow bags.",
# "dark yellow bags contain 2 dark green bags.",
# "dark green bags contain 2 dark blue bags.",
# "dark blue bags contain 2 dark violet bags.",
# "dark violet bags contain no other bags.",
# ]

import re, collections
rerule = re.compile("(?P<noother>^(?P<parent1>[a-z ]*) bags contain no other bags.$)|(?P<contains>^(?P<parent2>[a-z ]*) bags contain (?P<children>.*\.)+)$")
rechildren = re.compile("(?P<num>[0-9]+) (?P<colour>[a-z ]+) bag(s)?[,\.]")

class Child:
    def __init__(self, num, colour):
        self.colour = colour
        self.num = num

    def __repr__(self):
        return f"{self.num} x {self.colour}"

tree = {}

def parse(x):
    match = rerule.fullmatch(x)
    if match:
        d = match.groupdict()
        childrens = d['children']
        if childrens:
            children = []
            for childrenmatches in rechildren.finditer(childrens):
                cd = childrenmatches.groupdict()
                children.append(Child(int(cd['num']), cd['colour']))
            tree[d['parent2']] = children
        else:
            tree[d['parent1']] = None

# def paths(tree):
#     k = tree.keys()
#     inverted = collections.defaultdict(lambda: set())
#     for key in k:
#         children = tree[key]
#         if children:
#             for child in children:
#                 inverted[child.colour].add(key)

#     return inverted

# def traverse(remainder: set, inverted: collections.defaultdict):
#     used = set()
#     while remainder:
#         #print("XXXXX", ",".join(remainder))
#         val = remainder.pop()
#         used.add(val)
#         path = inverted[val]
#         #print(val, "<-", ",".join(path))
#         if path:
#             remainder.update(path - used)
#     return len(used) - 1


def traversetree(remainder: list, tree: dict):
    count = 0
    runs = 0
    while remainder:
        runs += 1
        val = remainder.pop()
        children = tree[val.colour]
        if children:
            for c in children:
                x = c.num * val.num
                count += x
                remainder.append(Child(x, c.colour))
    print(runs)
    return count

for rule in x:
    parse(rule)

# inverted = paths(tree)
# result = traverse(set(['shiny gold']), inverted)
# print("Part 1:", result)
# print(f"Took {time.time()*1000 - ms}ms")
# ms = time.time() * 1000

result = traversetree([Child(1, 'shiny gold')], tree)

print("Part 2:", result)

print(f"Took {time.time()*1000 - ms}ms")