CSES - Fixed Length Walk Queries
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You are given an undirected graph with nn nodes and mm edges. The graph is simple and connected.

You start at a specific node, and on each turn you must move through an edge to another node.

Your task is to answer qq queries of the form: "is it possible to start at node aa and end up on node bb after exactly xx turns?"

Input

The first line contains three integers nn, mm and qq: the number of nodes, edges and queries. The nodes are numbered 1,2,,n1,2,\dots,n.

After this, there are mm lines which describe the edges. Each line contains two integers aa and bb: there is an edge between nodes aa and bb.

Finally, there are qq lines, each describing a query. Each line contains three integers aa, bb and xx.

Output

For each query, print the answer (YES or NO) on its own line.

Constraints

  • 2n25002 \le n \le 2500
  • 1m50001 \le m \le 5000
  • 1q1051 \le q \le 10^5
  • 0x1090 \le x \le 10^9

Example

Input:

4 5 6
1 2
2 3
1 3
2 4
3 4
1 2 2
1 4 1
1 4 5
2 2 1
2 2 2
3 4 8

Output:

YES
NO
YES
NO
YES
YES

Explanation:

  • In query 1, a possible route is 1321 \rightarrow 3 \rightarrow 2.
  • In query 3, a possible route is 1321341 \rightarrow 3 \rightarrow 2 \rightarrow 1 \rightarrow 3 \rightarrow 4.
  • In query 6, a possible route is 3423421343 \rightarrow 4 \rightarrow 2 \rightarrow 3 \rightarrow 4 \rightarrow 2 \rightarrow 1 \rightarrow 3 \rightarrow 4.