Classification of 3-manifolds with certain spines