#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
using namespace std;
const double EPS = 1e-10;
double eps=1e-8;
const double INF = 1e+10;
const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
	double x, y;
	Pt() {}
	Pt(double x, double y) : x(x), y(y) {}
	Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
	Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
	Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
	Pt operator-() const { return Pt(-x, -y); }
	Pt operator*(const double &k) const { return Pt(x * k, y * k); }
	Pt operator/(const double &k) const { return Pt(x / k, y / k); }
	double ABS() const { return sqrt(x * x + y * y); }
	double abs2() const { return x * x + y * y; }
	double arg() const { return atan2(y, x); }
	double dot(const Pt &a) const { return x * a.x + y * a.y; }
	double det(const Pt &a) const { return x * a.y - y * a.x; }
};
inline bool operator< (const Pt&a,const Pt &b){
	int t=sig(b.x-a.x);
	if(t)return t>0;
	t=sig(b.y-a.y);
	return t>0;
}
double tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); }
int iCC(Pt a, double r, Pt b, double s) {
	double d = (b - a).ABS();
	if (sig(d) == 0 && sig(r - s) == 0) return -1; // correspond
	if (sig(r - s - d) > 0) return +2; // r > s
	if (sig(s - r - d) > 0) return -2; // s > r
	return (sig(r + s - d) >= 0) ? 1 : 0;
}
double dLP(Pt a, Pt b, Pt c) {
	return ABS(tri(a, b, c)) / (b - a).ABS();
}
pair<Pt,Pt> pCC(Pt a, double r, Pt b, double s) {
	double d = (b - a).ABS();
	double x = (d * d + r * r - s * s) / (d * 2);
	Pt e = (b - a) / d, w = e * Pt(0, 1) * sqrt(max(r * r - x * x, 0.0));
	return make_pair(a + e * x - w, a + e * x + w);
}
pair<Pt,Pt> pCL(Pt a, double r, Pt b, Pt c) {
	Pt h = b + (c - b) * (c - b).dot(a - b) / (c - b).abs2(); // perp(b, c, a)
	double d = (h - a).ABS();
	double y = sqrt(max(r * r - d * d, 0.0));
	Pt e = (c - b) / (c - b).ABS();
	return make_pair(h - e * y, h + e * y);
}

double x[130];
double y[130];
double r[130];
Pt p[130];
Pt ql[130];
Pt qr[130];
int fl[130];
int fr[130];
vector<Pt> v;
vector<int>now;
vector<pair<double,double> > seg;
int UF[4200];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;UF[a]+=UF[b];UF[b]=a;
}
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
	v.clear();now.clear();seg.clear();
	for(int i=0;i<4200;i++)UF[i]=-1;
	for(int i=0;i<a;i++)scanf("%lf%lf%lf",x+i,y+i,r+i);
	for(int i=0;i<a;i++){
		p[i]=Pt(x[i],y[i])*Pt(cos(1),sin(1));
	}
	for(int i=0;i<b;i++){
		double xa,xb,ya,yb;scanf("%lf%lf%lf%lf",&xa,&ya,&xb,&yb);
		ql[i]=Pt(xa,ya)*Pt(cos(1),sin(1));
		qr[i]=Pt(xb,yb)*Pt(cos(1),sin(1));
	}
	for(int i=0;i<a;i++){
		bool ok=true;
		for(int j=0;j<v.size();j++){
			if((p[i]-Pt(r[i],0)-v[j]).ABS()<eps)ok=false;
		}
		if(ok)v.push_back(p[i]-Pt(r[i],0));
		ok=true;
		for(int j=0;j<v.size();j++){
			if((p[i]+Pt(r[i],0)-v[j]).ABS()<eps)ok=false;
		}
		if(ok)v.push_back(p[i]+Pt(r[i],0));
	}
	for(int i=0;i<a;i++){
		for(int j=i+1;j<a;j++){
			if(iCC(p[i],r[i],p[j],r[j])==1){
				pair<Pt,Pt> tmp=pCC(p[i],r[i],p[j],r[j]);
				bool ok=true;
				for(int k=0;k<v.size();k++){
					if((v[k]-tmp.first).ABS()<eps)ok=false;
				}
				if(ok)v.push_back(tmp.first);
				ok=true;
				for(int k=0;k<v.size();k++){
					if((v[k]-tmp.second).ABS()<eps)ok=false;
				}
				if(ok)v.push_back(tmp.second);
			}
		}
	}
	std::sort(v.begin(),v.end());
	v.push_back(Pt(100000,0));
	seg.push_back(make_pair(-100000,100000));
	int sz=0;
	now.push_back(sz++);
	for(int i=0;i<b;i++){
		if(ql[i].x<v[0].x){
			fl[i]=0;
		}
		if(qr[i].x<v[0].x){
			fr[i]=0;
		}
	}
	for(int i=0;i<v.size()-1;i++){
		int t=1;
	//	printf("%.12f %.12f\n",v[i].x,v[i].y);
		double mx=(v[i+1].x+v[i].x)/2;
		vector<double>tmp2;
		tmp2.push_back(-100000);
		tmp2.push_back(100000);
		
		for(int j=0;j<a;j++){
			if(dLP(Pt(mx,0),Pt(mx,1),p[j])<r[j]){
				t+=2;
				pair<Pt,Pt>sc=pCL(p[j],r[j],Pt(mx,0),Pt(mx,1));
				tmp2.push_back(sc.first.y);
				tmp2.push_back(sc.second.y);
			}
		}
		std::sort(tmp2.begin(),tmp2.end());
		vector<double>tmp;
		tmp.push_back(tmp2[0]);
		for(int j=1;j<tmp2.size();j++)tmp.push_back(tmp2[j]);
		
		if(t>now.size()){
			int at=-1;
			for(int j=0;j<tmp2.size()-1;j++)if(tmp2[j]<v[i].y&&tmp2[j+1]>v[i].y)at=j;
			at--;
			now.push_back(-1);
			now.push_back(-1);
			for(int j=now.size()-3;j>=at;j--){
				now[j+2]=now[j];
			}
			now[at+1]=sz++;
		}else if(t<now.size()){
			int at=-1;
			for(int j=0;j<now.size();j++)if(seg[j].first<v[i].y&&v[i].y<seg[j].second)at=j;	
			UNION(now[at-1],now[at+1]);
			for(int j=at;j<now.size()-2;j++)now[j]=now[j+2];
			now.pop_back();now.pop_back();
		}else{
			int at=-1;
			for(int j=0;j<now.size();j++){
				int ci=-1;
				int cj=-1;
				for(int k=0;k<a;k++)if(ABS((Pt(mx,tmp2[j])-p[k]).ABS()-r[k])<eps)ci=k;
				bool ui=false;
				bool uj=false;
				if(v[i].y>p[ci].y)ui=true;
				for(int k=0;k<a;k++)if(ABS((Pt(mx,tmp2[j+1])-p[k]).ABS()-r[k])<eps)cj=k;
				if(v[i].y>p[cj].y)uj=true;
				if(!~ci||!~cj)continue;
				if(ABS((v[i]-p[ci]).ABS()-r[ci])<eps&&ABS((v[i]-p[cj]).ABS()-r[cj])<eps){
					if(ui&&tmp2[j]<p[ci].y)continue;
					if(uj&&tmp2[j+1]<p[cj].y)continue;
					if(!ui&&tmp2[j]>p[ci].y)continue;
					if(!uj&&tmp2[j+1]>p[cj].y)continue;
					
					at=j;
					now[at]=sz++;
				}
			}
		}
		for(int j=0;j<b;j++){
			if(v[i].x<ql[j].x&&ql[j].x<v[i+1].x){
				vector<double>z;
				for(int k=0;k<a;k++){
					if(dLP(Pt(ql[j].x,0),Pt(ql[j].x,1),p[k])<r[k]){
						pair<Pt,Pt>sc=pCL(p[k],r[k],Pt(ql[j].x,0),Pt(ql[j].x,1));
						z.push_back(sc.first.y);
						z.push_back(sc.second.y);
					}
				}
				z.push_back(-100000);
				z.push_back(100000);
				std::sort(z.begin(),z.end());
				for(int k=0;k<z.size()-1;k++){
					if(z[k]<ql[j].y&&ql[j].y<z[k+1]){
						fl[j]=now[k];
					}
				}
			}
			if(v[i].x<qr[j].x&&qr[j].x<v[i+1].x){
				vector<double>z;
				for(int k=0;k<a;k++){
					if(dLP(Pt(qr[j].x,0),Pt(qr[j].x,1),p[k])<r[k]){
						pair<Pt,Pt>sc=pCL(p[k],r[k],Pt(qr[j].x,0),Pt(qr[j].x,1));
						z.push_back(sc.first.y);
						z.push_back(sc.second.y);
					}
				}
				z.push_back(-100000);
				z.push_back(100000);
				std::sort(z.begin(),z.end());
				for(int k=0;k<z.size()-1;k++){
					if(z[k]<qr[j].y&&qr[j].y<z[k+1]){
						fr[j]=now[k];
					}
				}
			}
		}
		seg.clear();
		for(int j=0;j<tmp.size()-1;j++){
			seg.push_back(make_pair(tmp[j],tmp[j+1]));
		}
	}
	//for(int i=0;i<b;i++)printf("%d %d\n",fl[i],fr[i]);
	for(int i=0;i<b;i++){
		if(i)printf(" ");
		if(FIND(fl[i])==FIND(fr[i]))printf("YES");
		else printf("NO");
	}
	printf("\n");
	}
}

Measured memory_bytes: 1132