Find the Weak Connected Component in the Directed Graph(LintCode 432):

Problem