cf/mirror

Passable Paths (easy version)

CF
1702G11900· candidate master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
5
1 2
2 3
2 4
4 5
5
3
3 2 5
5
1 2 3 4 5
2
1 4
3
1 3 5
3
1 5 4
Output
YES
NO
YES
NO
YES
Sample 2of 2
Input
5
1 2
3 2
2 4
5 2
4
2
3 1
3
3 4 5
3
2 3 5
1
1
Output
YES
NO
YES
YES
1702G1.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…