Topological Sorting(LintCode 127):

Problem