Heterocyclic compounds containing 1,2-diazine or hydrogenated 1,2-diazine rings