https://123dok.net/document/zgw2v888-finding-nested-common-intervals-efficiently.html