You are given a directed acyclic graph with n vertices and mm edges. The vertices are labeled by 1,2,…,n, and the edges are labeled by 1,2,…,m.
You will be given qqueries. In the i-th query, you will be given four integers ui,vi, li and ri (1≤li≤ri≤m). You need to answer whether vertex ui can reach vertex vi when only edges labeled by k (li≤k≤ri) are available.
The first line contains a single integer T (1≤T≤10), the number of test cases. For each test case:
The first line contains three integers n,m and q (2≤n≤50,000, 1≤m≤100,000, 1≤q≤50,000), denoting the number of vertices, the number of edges, and the number of queries.
Each of the following m lines contains two integers ui and vi (1≤ui<vi≤n), denoting a directed edge from vertex ui to vertex vi.
In the next q lines, the ith line contains four integers ui, vi, li and ri (1≤ui<vi≤n, 1≤li≤ri≤m), describing the i-th query.
1
5 6 5
1 2
1 3
3 4
2 4
2 5
3 5
3 5 1 5
3 5 1 6
1 4 1 6
1 4 2 3
1 4 4 5
NO
YES
YES
YES
NO