We derive a general expression of the quantum Fisher information for a Mach-Zehnder interferometer, with the port inputs of an arbitrary pure state and a squeezed thermal state. We find that the standard quantum limit can be beaten, when even or odd states are applied to the pure-state port. In particular, when the squeezed thermal state becomes a thermal state, all the even or odd states have the same quantum Fisher information for given photon numbers. For a squeezed thermal state, optimal even or odd states are needed to approach the Heisenberg limit. As examples, we consider several common even or odd states: Fock states, even or odd coherent states, squeezed vacuum states, and single-photon-subtracted squeezed vacuum states. We also demonstrate that super-precision can be realized by implementing the parity measurement for these states.