An Algebraic Characterization of O-Minimal and Weakly O-Minimal MV-Chains