P20031 [HackerEarth] You are given a directed graph. However some edges have lost the direction in which they were facing. Now, you as a magician, want to direct each of the
普及
题目描述

You are given a directed graph. However some edges have lost the direction in which they were facing. Now, you as a magician, want to direct each of the
undirected edges in any of the two available directions.

For e.g., for an undirected edge (u,v) , you can convert it to directed edge u to v, or v to u.

But you hate cycles, so you want to make sure that there is no cycle in the graph after directing all the edges.
Is it possible to do that? If yes, print "Yes", else print "No".

Input Format:
First line contains T, number of Test Cases.
First line of each test contains N i.e. number of vertices,E1 i.e. number of directed edges, E2 i.e. number of undirected edges.
Next E1 lines contains two integers (u,v) denoting an directed edge from u to v.
Next E2 lines contains two integers (x,y) denoting an undirected edge between x and y.

Output Format:
Print "Yes" or "No" (without quotes) for each test case in a single line.

Constraints:
1 ≤ sum of N over all test cases ≤ 250000
1 ≤ sum of E1 over all test cases ≤ 250000
1 ≤ sum of E2 over all test cases ≤ 250000

Author: Sumeet Varma

SAMPLE INPUT
1
3 2 1
1 2
2 3
3 1

SAMPLE OUTPUT
Yes

输入格式

见题面

输出格式

见题面

样例输入
1 14 16 20 3 13 2 12 11 3 6 4 2 7 6 13 7 8 14 3 2 4 5 11 8 1 1 2 10 12 1 3 5 12 8 9 3 6 9 6 2 9 8 3 11 4 6 1 4 1 11 6 12 3 6 7 2 6 7 10 5 4 5 3 5 1 2 8 9 11 5 10 12 13 8 11
样例输出
No