A Prym construction for the cohomology of a cubic hypersurface. A homological criterion for reducibility of analytic spaces, with application to characterizing the theta divisor of a product of two general principally polarized abelian varieties 