The present invention provides a fused heterocyclic compound having an RORγt inhibitory action. The present invention relates to a compound represented by the formula (I'):wherein each symbol is as defined in the specification, provided that 2-(2-((4-cyanophenyl)amino)-2-oxoethoxy)-N-(9-ethyl-9H-carbazol-3-yl)acetamide and N-(4-cyanophenyl)-N'-(9-ethyl-9H-carbazol-3-yl)-3-methylpentanediamide are excluded, or a salt thereof.