getParents = str => {
const [name, rest]= str.split(" bags contain ")
if(rest==null) console.log(rest)
const bags = rest.split(",")
if(rest=="no other bags.") return [[name, null]]
const parents = rest.split(",")
.map(bag => bag.match(/(?<=\d+ ).*/)[0]
.replace(/ (bags|bag)(.|)/, "")
)
return parents.map(parent => [name, parent])
}