Set the starting ratio, the amount each group moves by, and the ratio it ends up in. The walkthrough attaches the unknown, applies the shift, cross-multiplies, solves, checks the result against the target ratio, and finishes by showing what the shift preserved and what it destroyed.
5 : 7, nine leave each group, becomes 7 : 11
x = 6 · 30 and 42 · gap 12 either side
Set the starting and finishing ratios to the same ratio — 1 : 2 and 1 : 2 — to see why no shift can leave a ratio where it was. Or set the shifts in opposite directions and watch the difference move as well as the ratio.