|Contests||Virtual Contests||Problems||Submit||Runs Status||Rank List||Forum|
The college has many students. Each one has a computer, but the computers can't send messages until the network build. For instance, A and B establish a network. Then they can send messages. After C and B build another network. A also can send messages to C. At the same time C to A is permission.
Every computer gets a number from 0 to make it easy.
There are several test cases.
The first line of every case is N M K. There are N computers, M connections and K questions. The connection maybe repeat.
The second line to 2+M-1 line are the relationship. If two computers are connected, the nuber of these two computers are found in the line. Every line has one relationship.
Follow the 2+M-1 line are the questions. 0 1 means whether the computer 0 and the computer 1 connected.(0 < N ≤ 10000, 0 < M ≤ 100000, 0 < K ≤ 10000)
Answer the questions. If the two computers can't send messages print NO. contrastively print YES.
3 1 2 1 0 0 1 1 2