Physical model of proton-pumping Q-cycle in respiratory and photosynthetic electron transport chains