Compounds of the formula I: ##STR00001## and pharmaceutically
acceptable salts thereof, wherein X is CH or N, Y is C or S, Z is
--(CR.sup.aR.sup.b).sub.r-- or --SO.sub.2--, A is --NR.sup.3-- or --O--,
R.sup.2 is optionally substituted aryl or optionally substituted
heteroaryl, n is 1 or 2, m is 1 when Y is C and m is 2 when Y is S, and
p, q, r, R.sup.1, R.sup.3, R.sup.4, R.sup.5, R.sup.6, R.sup.7, R.sup.8,
R.sup.9, R.sup.10, R.sup.a and R.sup.b are as defined herein. The
compounds are useful in the treatment of 5-HT.sub.6 and 5-HT.sub.2A
mediated diseases.