Paths to multiple subsets

I have a graph of users. Each user belongs to one group, and the users have links between them.
I want to find users where there is a path of max length X to users belonging to other groups, and I cant figure out the best way to do it.
If Im interested in two groups, say Group1 and Group2, I do apoc.path.subgraphNodes for Group1 and Group2, and then an apoc.path.expandConfig with one set of nodes as start nodes, and the other as end nodes.

But what do I do if I have 3, or more, groups, say Group1, Group2, Group3? I guess I want to find subgraphs with vertices in each of the groups.. Any ideas?