Analytical expressions for three-phase generalized relative permeabilities in water- and oil-wet capillary tubes