The present invention provides a novel benzene derivative or thiophene derivative useful as a VAP-1 inhibitor, or a medicament for the prophylaxis or treatment of a VAP-1 associated disease and the like, namely, a compound represented by the formula (I):wherein each symbol is as defined in the present specification, or a pharmaceutically acceptable salt thereof.