Let charge of magnitude q1 be placed of A and q2 on B. The condition will never be possibile when the charges are of the same sign .
.: either (i)q1>0 , q2<0 or (ii)q1<0 and q2>0
In (i)
If q1 is positive it will apply a force in the neg dire of x on the test charge and q2 being negative will apply a force in the + x dir. Now since distance of q1 from the test chatge is less , the forces on the test charge would be balanced only if |q1|<|q2|
In (ii) also because of the same reason |q1|<|q2|.
So the conditions possible are
q1<0,q2>0,|q1|<|q2|
& , q1>0, q2<0, |q1|<|q2|