Disclosed are compounds of formula (I) which are derivatives of 4-{ 2-[phenyl-3,6- dihydro-pyridin-1-yl]-2-oxo-alkyl} -1-piperazin-2-one and 4-{ 2-[phenyl-2,5-dihydro-pyrrol-1-yl]-2-oxo-alkyl} -1-piperazin-2-one, wherein: A, B, m, R3 and n are as defined in the specification. Also disclosed is the use of the compounds in the manufacture of a medicament for prevention or treatment of diseases related to the inhibition of p75NTR such as central nervous system, pain, inflammation and cancer. Further disclosed is a process for preparing a compound of formula (I).