Algebraic classification of linking pairings on 3-manifolds