Opposite Day Bread

A rebellious bakery wants to be different from its neighbors. Each neighbor bakery is labeled with what it usually bakes at its spot - one of two flavors: sweet or salty. For any new location the bakery considers, it first looks at k neighbors’ flavors based on their locations with straight-line (Euclidean L2) distance, then it picks the opposite flavor.

The first line of the input contains a single integer n representing the number of known bakeries. The next n lines each contain two floating-point numbers x y followed by a flavor for that spot: either sweet or salty.

The next line contains a single integer k.

The following line contains a single integer q representing the number of candidate locations. The last q lines each contain two floating-point numbers x y for a location to check.

For each location, print the flavor the bakery will pick for that spot. If there are multiple neighbors with the same distance, you should pick the ones that appear first in the input.

Input

Output

4
0 0 sweet
2 0 salty
0 2 salty
-1 -1 sweet
1
sweet salty
3
0.9 0.1
1.1 0
1.5 0.2

salty
sweet
sweet

5
0 0 sweet
2 0 salty
0 2 salty
-1 -1 sweet
3 3 sweet
3
sweet salty
2
1 1
2.4 0.1

sweet
salty

4
0 0 sweet
2 0 salty
0 2 salty
2 2 sweet
2
salty sweet
2
1 0.1
1 1.9

sweet
sweet

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue