Given an undirected graph with \(m\)edges, whose nodes are indexed from \(1\) to \(n\).

You are given \(q\) queries in the form of two integers \(x\) and \(y\). You have to check if there is an edge connected \(x\) and \(y\).

Submit: 405 Solved: 266

[Submit][Status][Web Board]

Given an undirected graph with \(m\)edges, whose nodes are indexed from \(1\) to \(n\).

You are given \(q\) queries in the form of two integers \(x\) and \(y\). You have to check if there is an edge connected \(x\) and \(y\).

You are given \(q\) queries in the form of two integers \(x\) and \(y\). You have to check if there is an edge connected \(x\) and \(y\).

The first line contains three integers \(n,m,q(n\le 1000,m,q\le 100000)\), i.e. the number of nodes, the number of edges, and the number of queries.

Then \(m\) lines follow. Each line contains two integers \(u,v(u\ne v,1\le u,v,\le n)\)which means an undirected edge connected \(u\)and \(v\).

Then \(q\) lines follow. Each line contains two integers \(x,y(x\ne y,1\le x,y,\le n)\)which means an undirected edge connected \(x\)and \(y\).

Then \(m\) lines follow. Each line contains two integers \(u,v(u\ne v,1\le u,v,\le n)\)which means an undirected edge connected \(u\)and \(v\).

Then \(q\) lines follow. Each line contains two integers \(x,y(x\ne y,1\le x,y,\le n)\)which means an undirected edge connected \(x\)and \(y\).

For each query \(x,y\), output "Yes" (without quotes) if there is an edge connected \(x\) and \(y\), and "No"(without quotes) otherwise.

```
5 5 5
1 2
2 3
3 4
4 5
2 4
1 3
4 2
2 1
5 4
5 2
```

```
No
Yes
Yes
Yes
No
```

There is no guarantee that there are no multiple edges.