A compound of formula I, or a pharmaceutically acceptable salt thereof, wherein: Ring A is Ring B is phenyl or pyridinyl; Ring C is pyrazolidinyl, pyrazolinyl, or pyrazolyl; each of which is optionally substituted; X is absent, -CH=CH-, -C≡C-, -O-, -S-, -SO 2 -, -SO-, -C -, -CO 2 -, -C N -, -OC N -, -NRC -, -NRC N -, -NRSO 2 -, or -N -; Y is absent, a divalent C 3-10 aryl, a divalent 3-8 membered saturated or partially unsaturated carbocyclic ring, a divalent 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a divalent 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; each R is independently hydrogen, C 1-6 aliphatic, C 3-10 aryl, a 3-8 membered saturated or partially unsaturated carbocyclic ring, a 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; or each R is independently -OR c,-SR c, -SO 2 R c, -SOR c, -C R c, -CO 2 R c, -C N R c, -OC N R c,-NRC R c, -NRC N R c, -NRSO 2 R c, or -N R c; two R groups on the same atom are taken together with the atom to which they are attached to form a C 3-10 aryl, a 3-8 membered saturated or partially unsaturated carbocyclic ring, a 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; R a is H or optionally substituted C 1-6 aliphatic; R b is H or optionally substituted C 1-6 aliphatic; each R c is independently H or optionally substituted C 1-6 aliphatic; n is 1, 2, 3, 4, or 5; p is 0, 1, 2, 3, or 4; and r is 0, 1, or 2. Ring A is Ring B is phenyl or pyridinyl; Ring C is pyrazolidinyl, pyrazolinyl, or pyrazolyl; each of which is optionally substituted; X is absent, -CH=CH-, -C≡C-, -O-, -S-, -SO 2 -, -SO-, -C -, -CO 2 -, -C N -, -OC N -, -NRC -, -NRC N -, -NRSO 2 -, or -N -; Y is absent, a divalent C 3-10 aryl, a divalent 3-8 membered saturated or partially unsaturated carbocyclic ring, a divalent 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a divalent 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; each R is independently hydrogen, C 1-6 aliphatic, C 3-10 aryl, a 3-8 membered saturated or partially unsaturated carbocyclic ring, a 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; or each R is independently -OR c,-SR c, -SO 2 R c, -SOR c, -C R c, -CO 2 R c, -C N R c, -OC N R c,-NRC R c, -NRC N R c, -NRSO 2 R c, or -N R c; two R groups on the same atom are taken together with the atom to which they are attached to form a C 3-10 aryl, a 3-8 membered saturated or partially unsaturated carbocyclic ring, a 3-7 membered heterocylic ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur, or a 5-6 membered monocyclic heteroaryl ring having 1-4 heteroatoms independently selected from nitrogen, oxygen, or sulfur; each of which is optionally substituted; R a is H or optionally substituted C 1-6 aliphatic; R b is H or optionally substituted C 1-6 aliphatic; each R c is independently H or optionally substituted C 1-6 aliphatic; n is 1, 2, 3, 4, or 5; p is 0, 1, 2, 3, or 4; and r is 0, 1, or 2.