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 nn: the number of lightning strikes. Each of the following nn lines describes an expected lightning strike, containing three integers ti,xi,rit_i, x_i, r_i: the time tit_i, position xix_i and blast radius rir_i of the strike. Uolevi should be at least rir_i meters away from the lightning at time tit_i, or he will be fried.

The next line contains the number of possible landing spots ss. Each of the following ss lines contains two integers, ei,yie_i, y_i meaning that the helicopter can land at time eie_i and position yiy_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 rir_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

  • 0n21050 \le n \le 2 \cdot 10^5
  • 0ti1090 \le t_i \le 10^9
  • 109xi109-10^9 \le x_i \le 10^9
  • 1ri1091 \le r_i \le 10^9
  • 1s21051 \le s \le 2 \cdot 10^5
  • 0ei1090 \le e_i \le 10^9
  • 109yi109-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:

@@*