Happy new year all! I have tried to find a solution to the following question without success:

- Say I have a node called
`Reminder`

which is associated with`Person`

`(r:Reminder)-[:WITH]->(p:Person)`

- I have an array of IDs, matching Persons:
`[1,2,3]`

I want to see if a reminder exists for:

- Each individual ID. For example, match a reminder where
`(p:Person {id: 1})`

, match a reminder where`(p:Person {id: 2})`

, match a reminder where`(p:Person {id: 3})`

- Any permutation: match a reminder where
`(p:Person {id: 1})`

and where`(p:Person {id: 2})`

or match a reminder where`(p:Person {id: 2})`

and where`(p:Person {id: 3})`

or match a reminder where`(p:Person {id: 1})`

and where`(p:Person {id: 3})`

or match a reminder where`(p:Person {id: 1})`

and where`(p:Person {id: 2})`

and where`(p:Person {id: 3})`

I do have a query which returns the reminder which belongs to the IDs `[1,2,3]`

but I am not sure how to also efficiently match the other permutations in the same query:

```
MATCH (p:Person)
WHERE p.id in [1,2,3]
WITH collect(p) as pnodes, count(p) as count, size([1,2,3]) as idCount
MATCH (r:Reminder)-[:WITH]->(p)
WHERE ALL (pt IN pnodes WHERE (r)-[:WITH]->(pt))
AND count = idCount
return distinct r
```

This returns any reminder which has exactly the three relationships. It doesn't return a reminder if any subset of the IDs also match. Is this possible?

All the best,

Nikolai