Compounds of the formula I: or a pharmaceutically acceptable salt thereof, wherein, X, Y, Z, R1, R2, R3, R4 and R5 are as defined herein. Also disclosed are methods of using the compounds for treating diseases associated with P2X3 and/or a P2X2/3 receptor antagonists and methods of making the compounds.