Balanced binary tree AC.