The present invention provides a novel compound having antiviral activity, especially HIV replication inhibitory activity and a medicament containing the same. The compound represented by the formula:wherein A3 is CR3A, CR3AR3B, N or NR3C; R3A, R3B, R4A and R4B are each independently a hydrogen atom, halogen, cyano, substituted or unsubstituted alkyl, substituted or unsubstituted alkynyl, or substituted or unsubstituted non-aromatic carbocyclyl; R3C is a hydrogen atom, substituted or unsubstituted alkyl, or substituted or unsubstituted non-aromatic carbocyclyl; ring T1 is substituted or unsubstituted nitrogen-containing non-aromatic heterocycle; R1 is a hydrogen atom, halogen, cyano, or substituted or unsubstituted alkyl; R2 is each independently substituted or unsubstituted alkyl or the like: n is 1 or 2; R3 is substituted or unsubstituted aromatic carbocyclyl or the like; R4 is a hydrogen atom or a carboxy protecting group.