- Time limit: 4.00 s
- Memory limit: 512 MB
Uolevi is performing a dangerous mission near Perälä. His life is in danger, so he must be evacuated at once. The only place from which a helicopter can pick him up is a straight road. Uolevi starts at the middle of the road (position 0) and can walk in either direction with the speed of 1 meter per second.
Unfortunately weather conditions have just gotten worse. A thunderstorm is coming our way, with its lightning strikes being a danger to both the helicopter and Uolevi. Therefore, there are only a few set times and places at which our helicopter can land. With our state-of-the-art equipment, we can predict where and when exactly will the lightning strike, and the area that is going to be burned. With this knowledge, determine which landing spots Uolevi can reach on time, avoiding the strikes.
Input
The first line of each test case contains an integer : the number of lightning strikes. Each of the following lines describes an expected lightning strike, containing three integers : the time , position and blast radius of the strike. Uolevi should be at least meters away from the lightning at time , or he will be fried.
The next line contains the number of possible landing spots . Each of the following lines contains two integers, meaning that the helicopter can land at time and position . You must determine if Uolevi can also be there at this time.
Note that if both landing spot and lightning strike have the same time and they are closer to each other than , the evacuation is impossible.
Output
Determine for all landing spots if Uolevi can be there at given time (without being struck by lightning), and output a line containing the answers. For each landing spot in the order they are given, output a single character @
if Uolevi can be evacuated from that spot and *
otherwise.
Constraints
Example
Input:
2 3 -1 1 2 1 1 3 1 1 3 1 2 1
Output:
@@*