Call containers by $A=10,B=10,C=5,D=4$.
Start by pouring $A$ into $C$, then $B$ into $D$. Pour $D$ into $A$, then $C$ into $B$, then $C$ into $D$. Now you have $1$ in $D$. Pour from $A$ into $C$, then from $C$ into $D$, leaving $2$ in $C$. Now pour from $D$ into $A$, then $B$ into $D$, then $D$ into $A$ again, leaving $2$ in $D$.
Alternate recipe (among many), uses "front loading":
Pour $A$ into $D$, $D$ into $C$, $A$ into $D$, $D$ into $C$, $C$ into $A$, $D$ into $C$, $B$ into $C$, $C$ into $A$ (note $C$ contains $2$), $A$ into $D$, and $D$ into $B$ and done.
The strategy in the first example was a sort of guess and check. In the second example, I focused on building appropriately-sized "holes" in the larger containers, which made it very easy.