Add interval queries to segment trees