- Time limit: 1.00 s
- Memory limit: 512 MB
A directed graph consists of nodes and edges. The edges are numbered .
Your task is to answer queries of the form "can you reach node from node ?"
Input
The first input line has three integers , and : the number of nodes, edges and queries.
Then there are lines describing the edges. Each line has two distinct integers and : there is an edge from node to node .
Finally there are lines describing the queries. Each line consists of two integers and : "can you reach node from node ?"
Output
Print the answer for each query: either "YES" or "NO".
Constraints
Example
Input:
4 4 3 1 2 2 3 3 1 4 3 1 3 1 4 4 1
Output:
YES NO YES