AlgoUniversity
  • Go Back
Discussion
Number Of Paths :

Author

Vaibhav Agarwal

Difficulty Level : Easy

Submissions : 751

Asked In : Adobe

Marks :10

: 13 | : 2

Hawking is a state containing N cities connected by M directed roads i.e. you can travel in only one direction. Linda challenged you and your K friends to start from a given city A and end their journey at city B without taking any road twice i.e. each friend travels on a unique path from A to B.

Task: Give whether you and your K friends will complete the challange or not, Print "YES" or "NO".

Constaints:

$$$1 \le T \le 10$$$

$$$2 \le N \le 150$$$

$$$1 \le M \le N*(N-1)$$$

$$$1 \le u, v \le N$$$

$$$1 \le K \le 500$$$

Input

First line contains T, number of test cases.

First line of each test case contains N and M, number of cities and roads.

Next M lines contains two integers u and v denoting there is a road from u to v.

Next line contains A, B and K, the starting and ending city, and the number of friends.

Output

For each test case, print "YES" or "NO" in a new line.

Examples

Input
2
5 4
1 2
2 3
3 4
4 5
1 5 2
5 4
1 2
2 3
3 4
4 5
1 5 1
Output
NO
YES
Input
1
6 12
1 3
1 4
1 5
1 6
2 3
2 4
2 5
2 6
3 4
3 5
4 5
4 6
3 5 1
Output
YES

Note

Sample Input:

1

5 4

1 2

2 3

3 4

4 5

1 5 2

Sample Output:

NO

Explanation:

Test Case 1: There is 1 path from 1 to 5, 1->2->3->4->5. So, 2 friends can't complete the challenge.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.