Provided are a novel nitrogen-containing heterocyclic compound represented by formula (I), and a salt or N-oxide compound thereof. Also provided is an agricultural/horticultural germicide that contains at least one of the above as an active ingredient. In formula (I), R represents the group represented by CR1R2R3or a cyano group. R1through R3each independently represent a hydrogen atom, an unsubstituted or substituted C1-8 alkyl group, an unsubstituted or substituted hydroxyl group, or the like. R4or R5represents a halogen group or the like. Y or Z represents a carbon atom or the like, and A or D represents a benzene ring or the like. X represents an oxygen atom, a nitrogen atom, or the like.La presente invención proporciona un compuesto heterocíclico nuevo conteniendo nitrógeno, una sal del mismo y un N-óxido del mismo, y un fungicida para el uso en agricultura y jardinería que contiene como principio activo al menos uno seleccionado de estos compuestos. En la fórmula (I), R representa un grupo CR1R2R3 o ciano. R1-R3 representan, independientemente entre sí, un átomo de hidrógeno, alquilo C1-8 sin sustituir o sustituido, hidroxilo sin sustituir o sustituido, etc. R4 o R5 representa halógeno, etc. Y o Z representan un átomo de carbono, etc., y A o D representan benceno, etc. X representa un átomo de oxígeno, de nitrógeno, etc. (ver fórmula (I)).