The present invention relates to compounds of the formula I, the N-oxides, tautomers, the prodrugs and the pharmaceutically acceptable salts thereof: In formula I the variables X1 is CH or N, X2 is O or S and where R1, R2, R3, R4 and Q 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. Thus, the invention also relates to the use of the compounds of the formula I, the N-oxides, tautomers, the prodrugs and the pharmaceutically acceptable salts thereof 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中,變數X1為CH或N,X2為O或S且其中R1、R2、R3、R4及Q係如申請專利範圍中所定義。該等式I化合物、其N-氧化物、互變異構體、前藥及醫藥學上可接受之鹽為磷酸二酯酶第10A型之抑制劑。因此,本發明亦係關於該等式I化合物、其N-氧化物、互變異構體、前藥及醫藥學上可接受之鹽用於製造藥物之用途,且其因此適於治療或控制選自神經病症及精神病症之醫學病症,適於改善與該等病症相關之症狀及適於降低該等病症之風險。