The present invention provide a heterocyclic compound having a HDAC inhibitory action, and useful for the treatment of autoimmune diseases and/or inflammatory diseases, graft versus host disease, cancers, central nervous diseases including neurodegenerative diseases, Charcot-Marie-Tooth disease and the like, and a pharmaceutical composition comprising the compound. The present invention relates to a compound represented by the formula (I): wherein each symbol is as defined in the specification, or a salt thereof.本發明提供一種雜環化合物其具有HDAC抑制活性,且有用於治療自體免疫疾病及/或發炎性疾病、移植物抗宿主病、癌症、包括神經退化疾病之中樞神經疾病、夏瑪杜三氏病等,以及包含該化合物之醫藥組成物。本發明關於式(I)所示化合物或其鹽:其中各符號如說明書所定義。