The present invention relates to compounds of the formula I, the N-oxides, tautomers, the prodrugs and the pharmaceutically acceptable salts thereof. where in formula I the variables X, Y, Q1, Q2 have the following meanings: X is C-R3 or N; Q1 is S or O and Q2 is C-R4 or N and Q2 is connected to X via a double bond while Q1 is connected to X via a single bond; or Q2 is S or O and Q1 is C-R4 or N and Q1 is connected to X via a double bond while Q2 is connected to X via a single bond; Y is C-R5 or N; where in formula I the variables R1, R2, R3, R4 and R5 are as defined in the claims The compounds of the formula I, the N-oxides, tautomers, the prodrugs and the pharmaceutically acceptable salts thereof are inhibitors of phosphodiesterase type 10A and to their use for the manufacture of a medicament and which thus are suitable for treating or controlling of medical disorders selected from neurological disorders and psychiatric disorders, for ameliorating the symptoms associated with such disorders and for reducing the risk of such disorders.本發明係關於式I之化合物、其N-氧化物、互變異構體、前藥及醫藥上可接受的鹽,其中,在式I中變量X、Y、Q1、Q2具有以下含義:X 為C-R3或N;Q1 為S或O及Q2為C-R4或N及Q2經雙鍵與X連接而Q1經單鍵與X連接;或Q2 為S或O及Q1為C-R4或N及Q1經雙鍵與X連接而Q2經單鍵與X連接;Y 為C-R5或N;其中,在式I中變量R1、R2、R3、R4及R5係如請求項中定義,該等式I化合物、其N-氧化物、互變異構體、前藥及醫藥上可接受的鹽為磷酸二酯酶第10A型之抑制劑,及係關於其於製造藥物上之用途,及該等化合物因而係適於治療或控制選自神經疾病及精神疾病之醫學疾病,適於改善與該等疾病相關之症狀,及適於降低罹患該等疾病之風險。