Physical loops in above configuration are: ABCHIJA, ABDEFGIJA, HCDEFGH,
Since the STP protocols that we use are not VLAN aware they will consider all the physical loops. We use RSTP/802.1w in our network. Both STP/802.1d and RSTP/802.1w are not VLAN aware. So the solution would be either to switch to a VLAN-aware spanning-tree protocol such as MSTP/802.1s or disable spanning-tree protocol on some ports altogether.
Since ports G and F are only in SAN (untagged VLAN ID 2) and none of the other ports are in this VLAN we can safely disable spanning-tree on ports G and F. So of the three physical loops mentioned above, only ABCHIJA is an actual loop and the other two are not loops because of the way the ports are assigned to VLAN.
Otherwise the link DE will be made inactive by spanning-tree and Switch-Y loses Internet access.
