On the cohomology of Seifert and graph manifolds