I am unable to figure out which test case I m missing. Need help although I have solved it using bfs but wanted to master dfs as well.I am a beginner in graphs. Thanks in advance :) .
[submission:https://codeforces.net/contest/580/submission/94433974]
given above is the submission link .