Where The First Rotation Fires

This AVL tree satisfies the height invariant, meaning at every node the two subtree heights differ by at most 1:

            20
          /    \
         8      30
        / \    /  \
       3  12  25   40

Insert 27, then insert 28. The first insert leaves the invariant intact. The second one breaks it at more than one node.

At which node is the lowest violation, and what fixes it?

A

At 30. A single right rotation at 30, after which 25 becomes the root of that subtree.

B

At 25. A single left rotation at 25, after which 27 is the root of that subtree with children 25 and 28.

C

At 20, the root. A single left rotation at 20, after which 30 becomes the root.

D

At 25. A double rotation, right at 27 then left at 25, after which 28 is the root of that subtree.