[Problem] To provide a compound which is useful as a novel and excellent prophylactic and/or therapeutic agent for rejection in various types of organ transplantation, allergic diseases, autoimmune diseases and blood tumors, and which acts in a manner relying on a PI3Kd-selective inhibitory activity and/or an IL-2-production-inhibiting activity and/or a B-cell-proliferation-inhibiting activity (including an activation-inhibiting activity). [Solution] Examination was made on compounds each having a PI3Kd-selective inhibitory activity and/or an IL-2-production-inhibiting activity and/or a B-cell-proliferation-inhibiting activity (including an activation-inhibiting activity), and it has been confirmed that a hetero ring compound having a chemical structure represented by formula (I) has a PI3Kd-selective inhibitory activity and/or an IL-2-production-inhibiting activity and/or a B-cell-proliferation-inhibiting activity (including an activation-inhibiting activity).