Merging two splay trees whose ranges may overlap in $O(\log N)$ I have two splay trees, $A$ and $B$.

When every element in $A$ is smaller than every element in $B$, we can merge them in $O(\log N)$.

My question is; when all elements of $A$ are not necessarily smaller than all elements of $B$, how can we still merge $A$ and $B$ in $O(\log N)$?

What I have already tried:

Splay $A$'s largest element, splay $B$'s smallest element. The root $R_A$ of $A$ doesn't have a right child anymore, and the root $R_B$ of $B$ doesn't have a left child anymore. Compare $R_A$ and $R_B$. If $R_B$ is bigger than $R_A$,  make $R_B$ the right child of $R_A$, which fails when $R_A$ is larger than $R_B$.
No, you cannot merge two splay trees whose ranges may overlap in  $O(\log N)$, where $N$ is the total number of nodes. You may have to move at least $\Theta(N)$ nodes in general or average situations.

It contains no information at all when we know "whose ranges may overlap". The ranges of any two splay trees may overlap.

It contains no information at all when we know all elements of A are not necessarily smaller than all elements of B. That is the same as all elements of A are not necessarily larger than all elements of B.