A compound of formula or a pharmaceutically acceptable salt, hydrate, or solvate thereof, wherein: X is H, (C 1 -C 6) alkyl, or halogen; X 1 is H or D; Y is H, D, C 1 -C 6 alkyl, or CN; L is -O(CR 3 R 4)-(C 6 -C 10) aryl, -NR 5 -(CR 3 R 4)-(C 6 -C 10) aryl, -O(CR 3 R 4)-5- or 6-membered heteroaryl, or -NR 5 -(CR 3 R 4)-5- or 6- membered heteroaryl, wherein the aryl and heteroaryl are optionally substituted with one or more R6; each R 1 and R 1 is independently H, (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, halogen, or -OH; R 2 is (C 6 -C 10) aryl or 5- or 6-membered heteroaryl, wherein the aryl and heteroaryl are optionally substituted with one or more R 7; R 2 is H, D, (C 1 -C 6) alkyl, or halogen; each R 3, R 4 and R 5 at each occurrence is independently H or (C 1 -C 6) alkyl; each R 6 is independently at each occurrence (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, or halogen; each R 7 is independently at each occurrence (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, or halogen; A is Q is N or CR 9; each of R 8 and R 9, at each occurrence, independently is H, halogen, cyano, (C 0 -C 6)alkyl-OR a, (C 0 -C 6)alkyl-NR a R b, (C 0 -C 6)alkyl-C R a, (C 0 -C 6)alkyl-P R a R b, (C 0 -C 6)alkyl-S p R a, NR e C R a, or NR e S 2 R a, or R w, or Rs and R 9, together with the atoms to which they are attached, form a 5- to 7-membered ring optionally comprising one or more heteroatoms selected from N, O, and S and optionally substituted with one or more R S1; each R w independently is (C 1 -C 6) alkyl, (C 1 -C 6) haloalkyl, (C 3 -C 8) cycloalkyl, 3- to 8-membered heterocycloalkyl, (C 6 -C 10) aryl, or 5 to 10-membered heteroaryl, each of which is optionally substituted with one or more R S2; each of R S1 and R S2, at each occurrence, independently is H, halogen, cyano, (C 1 -C 6) alkyl, (C 1 -C 6) haloalkyl, (C 0 -C 3)alkyl-OR c, (C 0 -C 3)alkyl-NR c R d, C OR c, or C NR c R d; each of R a, R b, R c, and R d independently is R i, (C 3 -C 8) cycloalkyl, 3- to 8-membered heterocycloalkyl, (C 0 -C 3)alkyl-OR g, or (C 0 -C 3)alkyl-NR g NR h, or R a and R b or R c and R d together with the atoms to which they are attached form a 5 to 7-membered ring optionally comprising one or more heteroatoms selected from N, O, and S; each of R e, R f, R g, R h, R i, and R j independently is H, (C 1 -C 6) alkyl or (C 1 -C 6) haloalkyl; n is 0, 1, or 2; and p is 0, 1, or 2. X is H, (C 1 -C 6) alkyl, or halogen; X 1 is H or D; Y is H, D, C 1 -C 6 alkyl, or CN; L is -O(CR 3 R 4)-(C 6 -C 10) aryl, -NR 5 -(CR 3 R 4)-(C 6 -C 10) aryl, -O(CR 3 R 4)-5- or 6-membered heteroaryl, or -NR 5 -(CR 3 R 4)-5- or 6- membered heteroaryl, wherein the aryl and heteroaryl are optionally substituted with one or more R6; each R 1 and R 1 is independently H, (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, halogen, or -OH; R 2 is (C 6 -C 10) aryl or 5- or 6-membered heteroaryl, wherein the aryl and heteroaryl are optionally substituted with one or more R 7; R 2 is H, D, (C 1 -C 6) alkyl, or halogen; each R 3, R 4 and R 5 at each occurrence is independently H or (C 1 -C 6) alkyl; each R 6 is independently at each occurrence (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, or halogen; each R 7 is independently at each occurrence (C 1 -C 6) alkyl, (C 1 -C 6) alkoxy, (C 1 -C 6) haloalkyl, (C 1 -C 6) haloalkoxy, or halogen; A is Q is N or CR 9; each of R 8 and R 9, at each occurrence, independently is H, halogen, cyano, (C 0 -C 6)alkyl-OR a, (C 0 -C 6)alkyl-NR a R b, (C 0 -C 6)alkyl-C R a, (C 0 -C 6)alkyl-P R a R b, (C 0 -C 6)alkyl-S p R a, NR e C R a, or NR e S 2 R a, or R w, or Rs and R 9, together with the atoms to which they are attached, form a 5- to 7-membered ring optionally comprising one or more heteroatoms selected from N, O, and S and optionally substituted with one or more R S1; each R w independently is (C 1 -C 6) alkyl, (C 1 -C 6) haloalkyl, (C 3 -C 8) cycloalkyl, 3- to 8-membered heterocycloalkyl, (C 6 -C 10) aryl, or 5 to 10-membered heteroaryl, each of which is optionally substituted with one or more R S2; each of R S1 and R S2, at each occurrence, independently is H, halogen, cyano, (C 1 -C 6) alkyl, (C 1 -C 6) haloalkyl, (C 0 -C 3)alkyl-OR c, (C 0 -C 3)alkyl-NR c R d, C OR c, or C NR c R d; each of R a, R b, R c, and R d independently is R i, (C 3 -C 8) cycloalkyl, 3- to 8-membered heterocycloalkyl, (C 0 -C 3)alkyl-OR g, or (C 0 -C 3)alkyl-NR g NR h, or R a and R b or R c and R d together with the atoms to which they are attached form a 5 to 7-membered ring optionally comprising one or more heteroatoms selected from N, O, and S; each of R e, R f, R g, R h, R i, and R j independently is H, (C 1 -C 6) alkyl or (C 1 -C 6) haloalkyl; n is 0, 1, or 2; and p is 0, 1, or 2.