[Problem] The present invention is to provide a novel pyrazole derivative, or a pharmaceutically acceptable salt thereof, a pharmaceutical composition comprising the same, and a pharmaceutical use thereof. [Solution] The present invention provides a compound represented by the formula (I) or a pharmaceutically acceptable salt thereof, which has TRPM8 inhibitory effects: wherein ring A is C 6-10 aryl or the like; X is CR 4a or the like; R 1 and R 2 are a hydrogen atom or the like; R 3 is a hydrogen atom or the like; R 4 is a hydrogen atom or the like; ring B is C 6-10 aryl or the like; R 5 is a hydrogen atom or the like; R 6a is a hydrogen atom or the like; R 7a is a hydrogen atom or the like; R 7b is a hydrogen atom or the like; R 6b is a hydrogen atom or the like; R 8 is a hydrogen atom or the like; n is 0, 1 or 2. Therefore, the compound represented by the formula (I) of the present invention or a pharmaceutically acceptable salt thereof is useful as an agent for treating or preventing diseases or symptoms caused by hyperexcitability or disorder of afferent neurons.