Synthesis of substituted hydrazines from triprotected precursors