#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pi M_PI
#define inf 1<<30
#define eps (1e-11)
#define MAX 101
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

int intersect(Circle a,Circle b){
  double dis=abs(a.c-b.c),sumr=a.r+b.r,minr=min(a.r,b.r),maxr=max(a.r,b.r);
  if((sumr-dis)<-eps)return 4;
  if(equals(sumr,dis))return 3;
  if((maxr-(dis+minr))<-eps)return 2;
  if(equals(dis+minr,maxr))return 1;
  return 0;
}

int in(Circle c,Point p){
  if(abs(c.c-p)-c.r<eps)return 1;
  return 0;
}

int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Vector a=g[i]-p,b=g[(i+1)%n]-p;
    if(abs(cross(a,b))<eps && dot(a,b)<eps)return 1;
    if(a.y>b.y)swap(a,b);
    if(a.y<eps && eps<b.y && cross(a,b)>eps)x=!x;
  }
  if(x)return 2;
  return 0;
}

int n,m;
vector<Circle> vc;
vector<int> e[MAX];
vector<Polygon> vp;
vector<int> v;
bool visited[MAX];

void make_Graph(){
  for(int i=0;i<MAX;i++)e[i].clear();
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(intersect(vc[i],vc[j])<=2){
        e[i].push_back(j);
        e[j].push_back(i);
      }
    }
  }
}

void get_Polygon(int ver){
  Polygon p;
  bool flag=false;
  for(int i=0;i<v.size();i++){
    if(ver==v[i])flag=true;
    if(flag)p.push_back(vc[v[i]].c);
  }
  if(p.size()<3)return;
  vp.push_back(p);
}

void dfs(int now,int before){
  visited[now]=true;
  v.push_back(now);
  for(int i=0;i<e[now].size();i++){
    int next=e[now][i];
    if(next==before)continue;
    if(visited[next])get_Polygon(next);
    else dfs(next,now);
  }
  v.pop_back();
  return;
}
void make_Polygon(){
  vp.clear();
  fill(visited,visited+MAX,0);
  for(int i=0;i<n;i++){
    if(!visited[i])dfs(i,-1);
  }
}

string check(Point s,Point t){
  int flag=false;
  for(int i=0;i<vc.size();i++){
    int tmp=in(vc[i],s)+in(vc[i],t);
    if(tmp==1)return "NO";
    if(tmp==2)flag=true;
  }
  if(flag)return "YES";
  for(int i=0;i<vp.size();i++){
    if(contains(vp[i],s)+contains(vp[i],t)==2)return "NO";
  }
  return "YES";
}

int main()
{
  while(1){
    cin>>n>>m;
    if(n+m==0)break;
    vc.clear();
    for(int i=0;i<n;i++){
      int a,b,c;
      cin>>a>>b>>c;
      vc.push_back(Circle(Point(a,b),c));
    }
    make_Graph();
    make_Polygon();
    for(int i=0;i<m;i++){
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      cout<<check(Point(a,b),Point(c,d));
      if(i!=m-1)cout<<" ";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244