#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll m,n,x,y,ans,ann;
struct node{
ll xxx,xx,yyy,yy;
}a[2000+10];
int main(){
cin>>m>>n;
for(ll i=1;i<=m;i++) cin>>a[i].xx>>a[i].yy>>a[i].xxx>>a[i].yyy;
for(ll i=1;i<=n;i++){
cin>>x>>y;
ans=0,ann=0;
for(ll j=1;j<=m;j++){
if(a[i].xx<=x && a[i].xxx>=x && a[i].yy<=y && a[i].yyy>=y) ans++,ann=j;
}
if(ans==0) cout<<"NO";
else cout<<"YES "<<ans<<" "<<ann<<endl;
}
return 0;
}