SP32946 ADABRANC - Ada and Branches

Description

Ada the Ladybug lives on a bush. A typical bush consists of some fruits connected with branches. Ada wants to travel between some fruits. Problem is that each edge can stand only some **X $ _{i} $** weigth (so if some creature with more weigth would like to travel over the edge, it would break and the creature would fall of the bush). Ada wants to make several travels so she asks you (for each such travel) to how many distinct fruits she can get?

Input Format

The first line of each test-case will contain three integers **2 , the number of fruits, **1 , the number of edges and **1 , the number of queries.****** The next **M** lines will contain three integers **0 , the fruits which are connected by and edge and **1 .**** The next **Q** lines will contain two integers **0 , the fruit Ada starts in and **1 , her actual weigth.**** **NOTE** Multiedges are allowed.

Output Format

For each query, output the number of fruits Ada can get to.