The present invention provides a compound represented by the formulawherein R1 is a hydrocarbon group optionally having substituent(s), amino optionally having substituent(s), hydroxy optionally having a substituent or a heterocyclic group optionally having substituent(s), R2 is a hydrogen atom or a hydrocarbon group optionally having substituent(s), R3 is a hydrogen atom, a halogen atom, a hydrocarbon group optionally having substituent(s), amino optionally having substituent(s), hydroxy optionally having a substituent or mercapto optionally having a substituent, Xa, Xb, Xc and Xd are each a carbon atom or a nitrogen atom, provided that any one or two of Xa, Xb, Xc and Xd is/are nitrogen atom(s), m is 0 to 2, and rings A to C are each a ring optionally having substituent(s), or a salt thereof, which is useful as an agent for the prophylaxis or treatment of a disease relating to an action of melatonin, and the like.