Provided is a novel tricyclic compound which has JAK inhibitory activity and is especially useful for prophylaxis, treatment or amelioration of autoimmune diseases, inflammatory diseases and allergic diseases. A novel tricyclic compound which is represented by formula (I), formula (II) or formula (III) (wherein each of A