The charge on the condensers in position 1 are as shown. Here
After the switch is thrown to position 2, the charges change as shown in (Fig-b). A charge q0 has flown in the right loop through the two condensers and a charge q0 through the cell, Because of the symmetry of the problem there is no change in the energy stored in the condensers. Thus
H (Heat produced) = Energy delivered by the cell