A compound of the formula:whereinX is —N═, —CH═, or the likeW is —CH2— or the likeU is —S— or the likeR1 and R2 are each independently hydrogen, halogen, optionally substituted lower alkyl, or the likeQ is a single bond or the likeR3 is hydrogen or the likeRing A is a 6-membered aromatic heterocyclic group having 1-3 nitrogen atomseach R4 is independently hydrogen, halogen, or the likem is an integer from 0 to 2G is —C(═O)— or the likeD is a single bond, —NH—, or the like andE is a cyclic quaternary ammonium group,or an ester, a protected compound at the amino on the ring in the 7-side chain, a pharmaceutically acceptable salt, or a solvate thereof.