Alternative solution -- compare interval-pairs lexicographically, in reverse order