Determination of the Second Homology and Cohomology Groups of a Space by Means of Homotopy Invariants.