There are courses labeled from to . You are given an array where prerequisites[i] = [a_i, b_i] means you must take course before course .
Return the ordering of courses you should take to finish all courses. If there are multiple valid answers, return any of them. If it is impossible to finish all courses, return an empty array.
Example :
- Input: ,
- Output: or
Example :
- Input: ,
- Output: (cycle exists, impossible)