The present invention relates to a compound represented by the formula
##STR00001## wherein R.sup.1 is an optionally substituted 5-membered
heterocyclic group; X is a bond etc.; Q is a divalent hydrocarbon group
having 1 to 20 carbon atoms; Y is a bond etc.; ring A is an aromatic ring
optionally further having 1 to 3 substituents; Z is
--(CH.sub.2).sub.n--Z.sup.1-- (n is an integer of 0 to 8 and Z.sup.1 is a
bond etc.) and the like; ring B is a 5-membered heterocycle optionally
further having 1 to 3 substituents; W is a divalent saturated hydrocarbon
group having 1 to 20 carbon atoms; R.sup.2 is --OH etc., or a salt
thereof. A pharmaceutical composition containing this compound is useful
as a prophylactic or therapeutic agent of diseases such as diabetes
mellitus and the like.