```#include<bits/stdc++.h>

#define ss(a)   scanf("%d", &a)
#define pb(a)   push_back(a)
#define endl    "\n"
using namespace std;
typedef long long ll;

int n, a, b, w, h, m;

typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<piii> vp;

int ww[101], hh[101];

int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
cin >> n;
vp win;
int cc = 0;
while (n!=0){
cc++;
win.clear();
for(int i=0;i<n;i++){
cin >>a >>b >>h >>w;
win.push_back({{a,b},i});
ww[i] = w;
hh[i] = h;
}
cin >> m;
sort(win.begin(),win.end());
cout << "Desktop " << cc << ":" << endl;
for(int i=0;i<m;i++){
cin >> a >> b;
int maxi = -1;
for(auto j: win){
int in = j.second, aj = j.first.first, bj = j.first.second;
if (j.first.first> a) break;
else{
if (a<aj+ww[in] && b>=bj && b<bj+hh[in]){
// cout << in << endl;
if (in > maxi) maxi = in;
}
//cout << maxi<< " " << in << " " <<aj << " " << bj << " " << ww[in] << " "<< hh[in] << " " << a << " " << b << endl;
}
}
if (maxi<0)
cout << "background"<<endl;
else
cout << "window " << maxi+1 << endl;
}
cin >> n;
}
}
```