The present invention provides a compound having excellent histone acetyltransferase inhibitory activity against EP300 and/or CREBBP, or a pharmacologically acceptable salt thereof. The compound is represented by the following formula (1) or a pharmacologically acceptable salt thereof:wherein ring Q1, ring Q2, R1, R2, R3 and R4 respectively have the same meanings as defined in the specification.