You are given a connected, undirected, weighted graph with $$$n$$$ vertices and $$$m$$$ edges labeled from $$$1$$$ through $$$m$$$. Define:
You have to process $$$q$$$ queries. For each query specified by a range $$$[l, r]$$$, count the number of pairs $$$(x, y)$$$ that satisfy the following:
The first line contains three integers $$$n$$$, $$$m$$$, and $$$q$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$, $$$n-1 \leq m \leq 2 \cdot 10^5$$$, $$$1 \leq q \leq 2 \cdot 10^5$$$) — denoting the number of vertices, the number of edges, and the number of queries.
The $$$i$$$-th of the next $$$m$$$ lines contains three integers $$$u_i$$$, $$$v_i$$$, and $$$w_i$$$ ($$$1 \leq u_i, v_i \leq n$$$, $$$1 \leq w_i \leq 10^9$$$) — representing the edges of the graph. It is guaranteed that the given edges form a connected graph. Note that the graph may contain self-loops and multiple edges.
Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le m$$$).
For each query, output a single integer — the number of valid pairs $$$(x, y)$$$.
4 6 31 4 201 2 102 3 203 4 51 3 152 4 251 62 51 5
4 1 2
| Name |
|---|


