My son asked me this question and I was stumped - my intuition says that is the south pole was strong enough the attraction between the north and south poles would outweigh the repulsion between the two north poles - but how strong would the south pole need to be in this case?
Assuming long skinny solenoidal magnets, so that their ends look like point magnetic sources, the force between two poles is $M1M2/r^2$, just like electrostatics, with pole density replacing charge density, where $M1$,$M2$ is the strength of the pole, and $r$ is the separation between the poles.
So you have three poles at position -A,0,A with magnitudes in the ratio 1:-1/4:1 respectively, the total repulsive force on the left-most one from the rightmost one is exactly balanced by the force from the middle one. Twice the distance means 1/4 the force.
For real magnets, you will usually not be able to get the other poles far enough away to have what looks like a monopole source. Then the answer depends on the geometry, but the above is a rough guide.