#C9125. City Distance Calculator

    ID: 53184 Type: Default 1000ms 256MiB

City Distance Calculator

City Distance Calculator

You are given the coordinates of several cities and a number of queries. Each query asks for the Euclidean distance between two cities.

The Euclidean distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is defined as:

\[ d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2} \]

Cities are numbered starting from 1, and each query contains two integers \( u \) and \( v \) representing the indices of the cities. Your task is to calculate the distance for each query and print the result with 6 decimal places of precision.

inputFormat

The input begins with an integer \( N \) representing the number of cities.

Each of the next \( N \) lines contains two space-separated numbers \( x_i \) and \( y_i \) giving the coordinates of the \( i \)-th city.

The next line contains an integer \( Q \) representing the number of queries.

Each of the following \( Q \) lines contains two space-separated integers \( u \) and \( v \), which are the indices of the cities for which you have to compute the distance.

outputFormat

For each query, output a single line containing the Euclidean distance between the two cities, rounded to 6 decimal places.

## sample
4
0 0
0 1
1 0
1 1
3
1 2
2 3
3 4
1.000000

1.414214 1.000000

</p>