시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB25111045.455%

문제

A construction site is defined as a rectangle in the coordinate system with sides parallel to the coordinate axes, with one corner in (0,0) and the opposite corner in (X,Y). 

The entrance to the site is in the middle of the bottom side. There are N cranes on the construction site. Each crane is situated in a point on the site, it can rotate 360 degrees and the maximum reach is known for each crane. 

The truck unloads heavy equipment on the entrance of the site and after that the equipment is carried across the site by a sequence of crane movements. In each step, one crane picks up the equipment and leaves it at any place within the maximum reach of that crane. 

Write a program that, given a list of K destinations within the site, determines for each destination if it is possible to carry the equipment to this destination. 

입력

The first line of input contains two integers X and Y, 2 ≤ X,Y ≤ 200, X is even. 

Next line contains an integer N, 1 ≤ N ≤ 50, the number of cranes. 

Each of the following N lines contains three integers A, B and C – (A,B) is the position of the crane, and C is its maximum reach, 0 ≤ A ≤ X, 0 ≤ B ≤ Y, 0 ≤ C ≤ 200. 

The next line contains an integer K, 3 ≤ K ≤ 30, the number of destinations. 

Each of the following N lines contains two integers D and E – (D,E) is the position of one destination, 0 ≤ D ≤ X, 0 ≤ E ≤ Y. 

출력

Each of the K lines should contain the word 'DA' or 'NE' – 'DA' means that it is possible to deliver the equipment to that destination, and 'NE' means that it is not possible. 

예제 입력 1

4 4
2
2 1 1
2 3 1
4
2 2
3 2
1 2
2 3

예제 출력 1

DA
NE
NE
DA

예제 입력 2

6 10
3
3 3 2
6 0 3
0 8 5
5
4 1
2 4
4 10
5 10
5 9

예제 출력 2

DA
DA
DA
NE
NE

예제 입력 3

8 5
4
2 1 3
4 5 1
6 4 1
5 2 2
5
0 2
0 3
4 4
7 4
7 5

예제 출력 3

DA
DA
NE
DA
NE