Find disconnected subsets for a two-way classification