A compound of the formula I: and pharmaceutically acceptable salts thereof, wherein: Y is selected from -C(R a)(R b)-, -C(R a)(R b)-C(R a)(R b)-, -C(R a)=C(R b)-, -OCH 2 -, -OCH(C 1-3 alkyl)-, -OC(C 1-3 alkyl) 2 -, -O(CH 2) 2-5 -, -SCH 2 -, -SCH(C 1-3 alkyl)-, -SC(C 1-3 alkyl) 2 - and-S(CH 2) 2-5 -; Z is -C -(C(R d)(R e)) n - or -C -C(R f)(R g)-O-, wherein n is 0, 1 or 2; Cy is aryl, heteroaryl or C 3-6 cycloalkyl optionally fused to a benzene, each of which is optionally substituted with 1 to 4 groups independently selected from R c; R 1 is selected from H, halogen, -OC 1-6 alkyl, and -C 1-6 alkyl; R2 is selected from H, halogen, -C 1-6 alkyl, -OC 1-6 alkyl, -SC 1-6 alkyl, -S C 1-6 alkyl,-S 2 C 1-6 alkyl, -CN, aryl and heteroaryl; R 3 is selected from H, C 1-6 alkyl and benzyl optionally substituted on the phenyl portion with 1 to 3 halogen; Ra and R b are independently H, aryl, heteroaryl, C 1-6 alkyl or haloC 1-6 alkyl; or R a and R b together with the carbon atom to which they are both attached form a C 3-6 cycloalkyl ring; or R a and R b together with the adjacent carbon atoms to which they are attached form a C 3-6 cycloalkyl ring; R c is selected from halogen, NR f R g, SO 2 NR f R g, CN, C 1-6 alkoxy, C 1-6 alkyl, haloC 1-6 alkoxy, and haloC 1-6 alkyl; Rd and R e arc independently selected from hydrogen, C 1-6 alkyl, -C 5-6 alkyl-C 3-6 cycloalkyl, hydroxy, C 1-6 alkoxy, aryl optionally substituted with 1 to 3 groups independently selected from R c, and NR f R g; or Rd, Re together with the carbon atom to which they are both attached form a C 3-6 cycloalkyl optionally having a ring heteroatom selected from -O-, -S-, -N(C R f)- and -N(R f)-, and optionally substituted with 1 to 3 C 1-3 alkyl groups; or R d, R e attached to adjacent carbon atoms together with the carbon atoms to which they are attached form a C 3-6 cycloalkyl optionally having a ring heteroatom selected from -O-, -S-, - N(C R f)- and -N(R f)-, and optionally substituted with 1 to 3 C 1-3 alkyl groups; and R f and R g are independently selected from hydrogen and C 1-3 alkyl; or R f, R g together with the atom to which they are both attached form a 3- to 6-membered ring. Y is selected from -C(R a)(R b)-, -C(R a)(R b)-C(R a)(R b)-, -C(R a)=C(R b)-, -OCH 2 -, -OCH(C 1-3 alkyl)-, -OC(C 1-3 alkyl) 2 -, -O(CH 2) 2-5 -, -SCH 2 -, -SCH(C 1-3 alkyl)-, -SC(C 1-3 alkyl) 2 - and-S(CH 2) 2-5 -; Z is -C -(C(R d)(R e)) n - or -C -C(R f)(R g)-O-, wherein n is 0, 1 or 2; Cy is aryl, heteroaryl or C 3-6 cycloalkyl optionally fused to a benzene, each of which is optionally substituted with 1 to 4 groups independently selected from R c; R 1 is selected from H, halogen, -OC 1-6 alkyl, and -C 1-6 alkyl; R2 is selected from H, halogen, -C 1-6 alkyl, -OC 1-6 alkyl, -SC 1-6 alkyl, -S C 1-6 alkyl,-S 2 C 1-6 alkyl, -CN, aryl and heteroaryl; R 3 is selected from H, C 1-6 alkyl and benzyl optionally substituted on the phenyl portion with 1 to 3 halogen; Ra and R b are independently H, aryl, heteroaryl, C 1-6 alkyl or haloC 1-6 alkyl; or R a and R b together with the carbon atom to which they are both attached form a C 3-6 cycloalkyl ring; or R a and R b together with the adjacent carbon atoms to which they are attached form a C 3-6 cycloalkyl ring; R c is selected from halogen, NR f R g, SO 2 NR f R g, CN, C 1-6 alkoxy, C 1-6 alkyl, haloC 1-6 alkoxy, and haloC 1-6 alkyl; Rd and R e arc independently selected from hydrogen, C 1-6 alkyl, -C 5-6 alkyl-C 3-6 cycloalkyl, hydroxy, C 1-6 alkoxy, aryl optionally substituted with 1 to 3 groups independently selected from R c, and NR f R g; or Rd, Re together with the carbon atom to which they are both attached form a C 3-6 cycloalkyl optionally having a ring heteroatom selected from -O-, -S-, -N(C R f)- and -N(R f)-, and optionally substituted with 1 to 3 C 1-3 alkyl groups; or R d, R e attached to adjacent carbon atoms together with the carbon atoms to which they are attached form a C 3-6 cycloalkyl optionally having a ring heteroatom selected from -O-, -S-, - N(C R f)- and -N(R f)-, and optionally substituted with 1 to 3 C 1-3 alkyl groups; and R f and R g are independently selected from hydrogen and C 1-3 alkyl; or R f, R g together with the atom to which they are both attached form a 3- to 6-membered ring.