Only Trust the Neighbors
A cautious field sensor only speaks up when nearby readings agree. At a new spot on the map, it looks around; if no known readings are close enough, it stays quiet and prints unknown. If some are nearby, it blends the voices of up to k closest ones and reports their average. Nearness is measured by straight-line distance on the 2D map.

The first line of the input contains a single integer n representing the number of known readings.
Each of the next n lines contains two floating-point numbers x y followed by a floating-point value v, describing one reading’s position and value.
The next line contains two values: an integer k and a floating-point number D representing the maximum number of neighbors to use and the distance cutoff. Only readings with distance ≤ D are considered.
The next line contains a single integer q representing the number of locations to evaluate.
Each of the last q lines contains two floating-point numbers x y for a location where the sensor wants a prediction.
For each location, print either unknown or the mean of the selected nearby values.
Input  | Output  | 
|---|---|
4  | 10  | 
5  | 4  | 
3  | 2  | 
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB