The present invention provides condensed heterocyclic derivatives which exhibit potent Smo inhibitory activity and uses thereof. Specifically, the present invention relates to compounds of formula [Wherein each symbol has the same meaning as defined in the description] or a salt thereof, and a Smo inhibitor, a prophylactic or therapeutic agent for cancer, the compound or a prodrug thereof It is related to medicine.本発明は、強力なSmo阻害活性を示す縮合複素環誘導体およびその用途を提供する。具体的には、本発明は、式〔式中、各記号は明細書本文と同意義である〕で表される化合物またはその塩、ならびに、Smo阻害剤、癌の予防または治療剤である、当該化合物またはそのプロドラッグを含有してなる医薬に関する。