The present invention provides a cyclic amide derivative useful as a drug for treating thrombosis, which is represented by the formula (I):wherein R1 represents an optionally substituted cyclic hydrocarbon group or an optionally substituted heterocyclic group, W represents a bond or an optionally substituted divalent chain hydrocarbon group, a represents 0, 1, or 2, X1 represents an optionally substituted lower alkylene or an optionally substituted lower alkenylene, Y1 represents - C(O)-, -S(O)- or -S(O)2-, A represents a piperazine ring which may be further substituted or a piperidine ring which may be further substituted, X2 represents a bond or an optionally substituted lower alkylene, Y2 represents -C(O)-, -S(O)-, -S(O)2- or -C(=NR7)-, X3 represents an optionally substituted C1-4 alkylene or an optionally substituted C2-4 alkenylene, Z3 represents -N(R4)-, -O- or a bond, Z1 represents -C(R2)(R2)-, -N(R2)-, etc., and Z2 represents - C(R3)(R3)-, -N(R3)-, etc., or a salt thereof.