(This question is a variation of the LeetCode question 207. Course Schedule. If you haven't completed that question yet, it is recommended to solve it first.)
Ordered integer sequences may share values while imposing relative-order requirements on those values.
You are given sequences, a list of integer sequences. Each inner list represents one sequence in its given order, and different sequences may have different lengths and share integers.