You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an undirected graph with edges, whose nodes are indexed from to .
You are given queries in the form of two integers and . You have to check if there is an edge connected and .
Input
The first line contains three integers , i.e. the number of nodes, the number of edges, and the number of queries.
Then lines follow. Each line contains two integers which means an undirected edge connected and .
Then lines follow. Each line contains two integers which means an undirected edge connected and .
Output
For each query , output "Yes" (without quotes) if there is an edge connected and , and "No"(without quotes) otherwise.
Sample Input
5 5 5
1 2
2 3
3 4
4 5
2 4
1 3
4 2
2 1
5 4
5 2
Sample Output
No
Yes
Yes
Yes
No
HINT
There is no guarantee that there are no multiple edges.