impl segment tree