The diodes are in anti-parallel. When the line polarity is in one direction, one diode conducts aad drops ~1.2V. When the line polarity reverses, the other diode conducts and has a drop of Vf=~1.2v, but with the opposite polarity. One set of 3-series diodes functions with one LED and the other set of 3-series diodes functions with the other LED. Since the resistor is not polarity sensitive, it functions half the time with one LED, and half the time with the other...on opposite polarity line cycles.