A glucokinase activator is provided and a treatment and/or a preventive for diabetes, or a treatment and/or a preventive for diabetes such as retinopathy, nephropathy, neurosis, ischemic cardiopathy, arteriosclerosis, and further a treatment and/or a preventive for obesity are provided. The invention relates to a compound of a formula (I): [wherein R 1 and R 2 represent a hydrogen, etc. R 3 represents a hydrogen atom, a halogen atom, etc. R 4 each independently represents a hydrogen atom, a lower alkyl group, etc. Q represents a carbon atom, a nitrogen atom or a sulfur atom (the sulfur atom may be mono- or di-substituted with an oxo group) R 5 and R6 each represent a hydrogen atom, a lower alkyl group, etc. X 1 , X 2 , X 3 and X 4 each independently represent a carbon atom or a nitrogen atom Z represents an oxygen atom, a sulfur atom or a nitrogen atom Ar represents an aryl or heteroaryl group optionally mono to tri-substituted with a group selected from the substituent group ² ring A represents a 5- or 6-membered nitrogen-containing heteroaromatic group m indicates an integer of from 1 to 6 n indicates an integer of from 0 to 3 p indicates an integer of from 0 to 2 (provided that at least two of X 1 to X 4 are carbon atoms) q indicates 0 or 1] or its pharmaceutically-acceptable salt, which has an effect of glucokinase activation and is useful as a treatment for diabetes.