The invention relates to compounds of formula I
wherein A
1
, A
2
, A
3
, B, R
1
, R
2
, R
3
and R
4
are as defined in the description and in the claims, as well as physiologically acceptable salts thereof. These compounds inhibit PDE10A and can be used as medicaments.