Adam is making Bob a hand-crafted necklace as a gift. A necklace consists of n beads, numbered 0 to n−1 from left to right. Each bead can either be red or blue in colour. Bob has sent Adam a list of r requirements for the necklace. The ith requirement (0≤i<r) states that the beads from positions a\[i] to b\[i] inclusive should have x\[i] unique colours.
Help Adam find a possible configuration of beads that satisfies all of Bob's requirements, or determine that it is impossible.