Isotopic abundance of nitrogen and carbon in distant comets