function parse(input) {
const [order, page] = input.split("\n\n");
const orders = order.split("\n").reduce((map, d) => {
const [p1, p2] = d.split("|").map(Number);
map.set(p1, [...(map.get(p1) || []), p2]);
return map;
}, new Map());
const pages = page.split("\n").map((d) => d.split(",").map(Number));
return [orders, pages];
}