


1. The given graph may have self-loops and parallel edges.
Consider ‘N’ = 4, ‘EDGES’ = [[0, 1], [0, 3], [1, 2], [3, 2]], ‘SRC’ = 0 and ‘DEST’ = 2. The given directed graph is shown below.

Here, all the paths that start from node 0 are -:
1. 0->1->2
2. 0->3->2
Both of these paths eventually end at node ‘2’ i.e node ‘DEST’. Thus we should return True.
The first line of input contains an integer ‘T’ denoting the number of test cases. then ‘T’ test cases follow.
The first line of each test case consists of four single space-separated integers ‘N’, ‘M’, ‘SRC’, ‘DEST’, described in the problem statement.
Then next ‘M’ lines follow in each test case. The ith line consists of two space-separated integers ‘EDGES[i][0]’ and ‘EDGES[i][1]’ representing that there is a directed edge from node ‘EDGES[i][0]’ to ‘EDGES[i][1]’.
For each test case, print a string “True” if all paths starting from node ‘SRC’ eventually end at node ‘DEST’, Otherwise, print “False”.
Print output of each test case in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 50
2 <= N <= 10^4
0 <= M <= 10^4
0 <= SRC < N
0 <= DEST < N
SRC != DEST
0 <= EDGES[i][j] < N.
Where ‘T’ is the total number of test cases, ‘N’, ‘M’, ‘SRC’, and ‘DEST’ are as described in the problem statement. ‘EDGES[i][j]’ is an integer in list ‘EDGES’.
Time limit: 1 sec
All the paths starting from node ‘SRC’ eventually end at node ‘DEST’ if -:
We can check these conditions using the Depth First Search algorithm as follows -: