#include<bits/stdc++.h>
using namespace std;
int n,m,a[2002][2002];
int xi,xj,yi,yj,x,y,h,s;
int main() {
cin>>n>>m;
for(int i=1; i<=n; i++) {
cin>>xi>>yi>>xj>>yj;
}
for(int k=1; k<=m; k++) {
cin>>x>>y;
for(int i=1; i<=n; i++) {
if(x>=xi&&x<=xj&&y>=yi&&y<=yj) {
s++;
h=i;
}
}
}
if(s!=0) cout<<"YES"<<" "<<s<<" "<<h;
else cout<<"NO";
return 0;
}