The [NH 2 , C, N, O] and the [NH 2 , C, N, S] systems were investigated by quantum-chemical computations and matrixisolation spectroscopic methods. The equilibrium structures of the isomers and their relative energies were determined by CCSD(T) method. This was followed by the computation of the harmonic and anharmonic vibrational wavenumbers, infrared intensities, relative Raman activities and UV excitation energies. These computed data were used to assist the identification of products obtained by UV laser photolysis of 3,4-diaminofurazan, 3,4-diaminothiadiazole and 1,2,4thiadiazole-3,5-diamine in low-temperature Ar and Kr matrices. a Experimentally, first the precursors were studied by matrix-isolation IR and UV spectroscopic methods. Based on these UV spectra, different wavelengths were selected for photolysis. The irradiations, carried out by a tunable UV laser-light source, resulted in the decomposition of the precursors, and in the appearance of new bands in the IR spectra. Some of these bands were assigned to cyanamide (H 2 NCN) and its isomer, the carbodiimide molecule (HNCNH), generated from H 2 NCN. By the analysis of the relative absorbance vs. photolysis time curves, the other bands were grouped to three different species both for the O-and the S-containing systems. In the case of the O-containing isomers, these bands were assigned to the H 2 NNCO:H 2 NCN, and H 2 NCNO:H 2 NCN complexes, and to the ring-structure H 2 NC(NO) isomer. In a similar way, the complexes of H 2 NNCS and H 2 NCNS with the H 2 NCN, and H 2 NC(NS) were also identified. 1,2,4-thiadiazole-3,5-diamine was also investigated in similar way like the above mentioned precursors. The results of this study also support the identification of the new S-containing isomers. Except for H 2 NNCO and H 2 NCNS, these molecules were not identified previously. It is expected that at least some of these species, like the methyl isocyanate (CH 3 CNO) isomer b,c , are present and could be identified in astrophysical objects.