CSES - KILO 2017 2/5 - Evacuation
  • 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 n: the number of lightning strikes. Each of the following n lines describes an expected lightning strike, containing three integers t_i, x_i, r_i: the time t_i, position x_i and blast radius r_i of the strike. Uolevi should be at least r_i meters away from the lightning at time t_i, or he will be fried.

The next line contains the number of possible landing spots s. Each of the following s lines contains two integers, e_i, y_i meaning that the helicopter can land at time e_i and position y_i. 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 r_i, 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

  • 0 \le n \le 2 \cdot 10^5
  • 0 \le t_i \le 10^9
  • -10^9 \le x_i \le 10^9
  • 1 \le r_i \le 10^9
  • 1 \le s \le 2 \cdot 10^5
  • 0 \le e_i \le 10^9
  • -10^9 \le y_i \le 10^9

Example

Input:

2
3 -1 1
2 1 1
3
1 1
3 1
2 1

Output:

@@*