Python Topological Sort Leetcode