If we pairwise identify both As and Bs, then the resulting space is a torus. Now, WLOG, let's make a hole in the center. Then it deformation retracts to its boundary. When we pairwise identify both As and Bs, the resulting space is a wedge sum of two circles, a.k.a, figure 8 space.
For a space , we can use the above figure with a slight modification. We don't pairwise identify either As or Bs. Assume we pairwise identify Bs only. Actually, B is the real line, so we cannot draw using a polygon. This is just for illustration purpose. The resulting space having a hole at the center after deformation retract is "O-O", where "-" is a real line. A real line can be deformation retracted to a point, "O-O" is homotopy equivalent to "OO", which is a figure 8 space.
Thus we conclude that both spaces are homotopy equivalent.