Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

3499.   Network
Time Limit: 1.0 Seconds   Memory Limit: 65536K
Total Runs: 657   Accepted Runs: 233



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.

Input

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)

Output

Answer the questions. If the two computers can't send messages print NO. contrastively print YES.
 

Sample Input

3 1 2
1 0
0 1
1 2

Sample Output

YES
NO



Source: TJRAC Team Selection 2010 (2)
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz