Update ternary tree