Find Eventual Safe States

Implement solve for Find Eventual Safe States. Return the required output for the provided arguments.

Examples
Input: [[1,2],[2,3],[5],[0],[5],[],[]]
Output: [2,4,5,6]
Hints

Find Eventual Safe States

Implement `solve` for **Find Eventual Safe States**. Return the required output for the provided arguments.