I have a set of patients that I split into two parts using some obscure algorithm (doesn't matter how): let the $X$ take on values $A$ and $B$. Each patient belongs to exactly one of 5 disease subtypes: let $S$ take on the values $a, b, c, d, e$. Here is the contingency table:
A B a 116 109 b 64 87 c 161 86 d 123 140 e 77 38
Using Fisher's exact test, I get a p-value of $5.274e-07$. So I conclude that $X$ and $S$ are somehow associated (or not independent). What I'd like to ask next is which subtypes are significantly associated with $X$. For example, subtype $a$ doesn't seem to deviate much from the expected number of $A$s and $B$s if $a$ is independent of $X$, while there seems to be an overrepresentation of $A$s within the $e$ subtype.
What kind of test would be appropriate here?
Could I use Fisher's exact test again for each of the subtypes separately. Or should I use something like logistic regression?