Formamide (H2NCHO) is the smallest molecule possessing the biologically important amide bond. Recent interstellar observations have shown a strong correlation between the abundance of formamide and isocyanic acid (HNCO), indicating that they are likely to be chemically related, but no experiment or theory explains this correlation satisfactorily. We performed H + H2NCHO reactions in a para-hydrogen quantum-solid matrix host and identified production of H2NCO and HNCO from hydrogen-abstraction reactions. We identified also D2NCO, DNCO, HDNCO, and HDNCHO from the reaction H + D2NCHO, indicating the presence of hydrogen-addition reactions of DNCO and HDNCO. From the observed temporal profiles of H2NCHO, H2NCO, HNCO, and their deuterium isotopologues, we showed that a dual-cycle consisting of hydrogen abstraction and hydrogen addition can satisfactorily explain the quasi-equilibrium between H2NCHO and HNCO and explain other previous experimental results. Furthermore, this mechanism also indicates that the catalytic formation of H2 from H atoms might occur in interstellar ice grains.