#include
#include
using namespace std;
int main() {
int n, m, x, y;
cin >> n >> m >> x >> y;
vector<vector<int>> bombed(n, vector<int>(m, 0));
for (int i = 0; i < x; i++) {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int j = x1; j <= x2; j++) {
for (int k = y1; k <= y2; k++) {
bombed[j - 1][k - 1]++;
}
}
}
for (int i = 0; i < y; i++) {
int px, py;
cin >> px >> py;
if (bombed[px - 1][py - 1] > 0) {
cout << "Y " << bombed[px - 1][py - 1] << " " << x << endl;
} else {
cout << "N" << endl;
}
}
return 0;
}