A compound of formula or a pharmaceutically acceptable salt thereof, wherein A is a saturated 3-6 membered carbocyclic ring and such ring may be substituted by one or more C 1-4 alkyl group; B is a saturated 4-6 membered heterocyclic ring, in which one or two carbon atoms may be replaced by an heteroatom selected from at least one Nitrogen or an Oxygen and the linking atom is always a Nitrogen atom; such ring may be also substituted at the carbon atoms or, possibly, at a different Nitrogen atom, by one or more C 1-4 alkyl group; G is phenyl, biphenyl, naphthyl or pyridyl, which may be optionally substituted by 1, 2, 3 4 or 5 substituents selected from the group consisting of: halogen, cyano, hydroxyl, amino, C 1-4 alkylamino, C 1-4 alkyl, C 1-4 alkoxy, haloC 1-4 alkyl, haloC 1-4 alkoxy, SF 5, C(=O)NH 2 and C(=O) z R 3; W is S, SO 2, O, CHR 2 or NR 3; n is 0 or 1; m is 1 or 2; p is 1 or 2; z is each independently 0 or 1; R is hydrogen or C 1-4 alkyl; C 1-4 alkoxy; R 1 is each independently hydrogen or F, C 1-4 alkyl; OH, C 1-4 alkoxy; R 2 is each independently hydrogen or F, C 1-4 alkyl; OH, C 1-4 alkoxy; R 3 is each independently hydrogen or C 1-4 alkyl; R 4 is each independently hydrogen or C 1-4 alkyl; or -C(=O)C 1-4 alkyl; -C(=O)C 1-4 alkoxyC 1-4 alkyl; -C(=O)C 3-6 cycloalkyl; R 5 is each independently hydrogen or C 1-4 alkyl; R 6 is each independently hydrogen or C 1-4 alkyl; R 7 is each independently halogen, C 1-4 alkyl; OH, C 1-4 alkoxy; G 1 is a 5-6-membered heteroaromatic group containing at least one ring nitrogen, which may be optionally substituted by 1, 2, or 3 substituents independently selected from the group consisting of: halogen, cyano, hydroxyl, amino, C 1-4 alkylamino, C 1-4 alkyl, haloC 1-4 alkyl, haloC 1-4 alkoxy, C 1-4 alkoxy, C(=O)NH 2 and C(=O) z R 3; Y is phenyl or a moiety selected from the group consisting of: 5-6 membered heteroaromatic group, a 8-11 membered heteroaromatic group, a saturated mono 3-7 membered carbocyclic group and a 8-11 membered bicyclic carbocyclic group, and for any of such groups one or more ring carbons may be replaced by N(R 4) z,, O, S; any of which groups may be optionally substituted by 1, 2 or 3 substituents selected from: halogen, cyano, hydroxyl, C 1-4 alkylamino, C 1-4 alkyl, C 1-4 alkoxy, haloC 1-4 alkyl, haloC 1-4 alkoxy, oxo, -NHC(=O)C 1-4 alkyl, -NR 5 R 6, SF 5, -(CH 2) z C(=O)NR 5 R 6, -C(=O) z R 3, -C 1-4 alkylCN, -SO 2 NR 5 R 6, Y' or OY'; Y' is phenyl, or a 5-6-membered heteroaromatic group optionally substituted by 1 or 2 R 7 groups. A is a saturated 3-6 membered carbocyclic ring and such ring may be substituted by one or more C 1-4 alkyl group; B is a saturated 4-6 membered heterocyclic ring, in which one or two carbon atoms may be replaced by an heteroatom selected from at least one Nitrogen or an Oxygen and the linking atom is always a Nitrogen atom; such ring may be also substituted at the carbon atoms or, possibly, at a different Nitrogen atom, by one or more C 1-4 alkyl group; G is phenyl, biphenyl, naphthyl or pyridyl, which may be optionally substituted by 1, 2, 3 4 or 5 substituents selected from the group consisting of: halogen, cyano, hydroxyl, amino, C 1-4 alkylamino, C 1-4 alkyl, C 1-4 alkoxy, haloC 1-4 alkyl, haloC 1-4 alkoxy, SF 5, C(=O)NH 2 and C(=O) z R 3; W is S, SO 2, O, CHR 2 or NR 3; n is 0 or 1; m is 1 or 2; p is 1 or 2; z is each independently 0 or 1; R is hydrogen or C 1-4 alkyl; C 1-4 alkoxy; R 1 is each independently hydrogen or F, C 1-4 alkyl; OH, C 1-4 alkoxy; R 2 is each independently hydrogen or F, C 1-4 alkyl; OH, C 1-4 alkoxy; R 3 is each independently hydrogen or C 1-4 alkyl; R 4 is each independently hydrogen or C 1-4 alkyl; or -C(=O)C 1-4 alkyl; -C(=O)C 1-4 alkoxyC 1-4 alkyl; -C(=O)C 3-6 cycloalkyl; R 5 is each independently hydrogen or C 1-4 alkyl; R 6 is each independently hydrogen or C 1-4 alkyl; R 7 is each independently halogen, C 1-4 alkyl; OH, C 1-4 alkoxy; G 1 is a 5-6-membered heteroaromatic group containing at least one ring nitrogen, which may be optionally substituted by 1, 2, or 3 substituents independently selected from the group consisting of: halogen, cyano, hydroxyl, amino, C 1-4 alkylamino, C 1-4 alkyl, haloC 1-4 alkyl, haloC 1-4 alkoxy, C 1-4 alkoxy, C(=O)NH 2 and C(=O) z R 3; Y is phenyl or a moiety selected from the group consisting of: 5-6 membered heteroaromatic group, a 8-11 membered heteroaromatic group, a saturated mono 3-7 membered carbocyclic group and a 8-11 membered bicyclic carbocyclic group, and for any of such groups one or more ring carbons may be replaced by N(R 4) z,, O, S; any of which groups may be optionally substituted by 1, 2 or 3 substituents selected from: halogen, cyano, hydroxyl, C 1-4 alkylamino, C 1-4 alkyl, C 1-4 alkoxy, haloC 1-4 alkyl, haloC 1-4 alkoxy, oxo, -NHC(=O)C 1-4 alkyl, -NR 5 R 6, SF 5, -(CH 2) z C(=O)NR 5 R 6, -C(=O) z R 3, -C 1-4 alkylCN, -SO 2 NR 5 R 6, Y' or OY'; Y' is phenyl, or a 5-6-membered heteroaromatic group optionally substituted by 1 or 2 R 7 groups.