The present inventon provides the following compounds having anti-viral activity. A 1 is CR 1A R 1B , S or O; A 2 is CR 2A R 2B , S or O; A 3 is CR 3A R 3B , S or O; A 4 is CR 4A R 4B , S or O; the number of hetero atoms among atoms constituting the ring which consists of A 1 , A 2 , A 3 , A 4 , nitrogen atom adjacent to A 1 and carbon atom adjacent to A 1 , is 1 or 2; R 1A and R 1B are each independently hydrogen, halogen, alkyl, or the like; R 2A and R 2B are each independently hydrogen, halogen, alkyl, or the like; R 3A and R 3B are each independently hydrogen, halogen, alkyl, or the like; R 4A and R 4B are each independently hydrogen, halogen, alkyl, or the like; R 3A and R 3B may be taken together to form non-aromatic carbocycle or non-aromatic heterocycle; X is CH 2 , S or O; R 1 is each independently halogen, hydroxy, or the like; m is any integer of 0 to 2; and n is any integer of 1 to 2.