#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
 
 
 
#define SIZE 105
 
struct Point{
    Point(double arg_x,double arg_y){
        x = arg_x;
        y = arg_y;
    }
 
    Point(){
        x = y = 0.0;
    }
 
    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 a){ return Point(a*x,a*y); }
    Point operator / (double a){ return Point(x/a,y/a); }
 
    double abs(){ return sqrt(norm()); }
    double norm(){ return x*x + y*y; }
 
    bool operator<(const Point &p) const{
        return x != p.x? x < p.x: y < p.y;
    }
 
    bool operator == (const Point &p) const{
        return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
    }
 
    double x,y;
};
 
typedef Point Vector;
typedef vector<Point> Polygon;
 
struct Circle{
    Point center;
    double r;
};
 
struct Line{
    Point p[2];
    Line(Point p1,Point p2){
        p[0] = p1;
        p[1] = p2;
    }
    Line(){
 
    }
};
 
struct Node{
    Node(int arg_circle_index,double arg_theta){
        circle_index = arg_circle_index;
        theta = arg_theta;
    }
    bool operator<(const struct Node &arg) const{
 
        return theta < arg.theta;
    }
    int circle_index;
    double theta;
};
 
int num_circle,num_line;
bool check[SIZE][SIZE];
Circle circle[SIZE];
vector<Node> NODES[SIZE];
vector<Polygon> POLYGON;
 
 
double norm(Vector a){
    return a.x*a.x+a.y*a.y;
}
 
double abs(Vector a){
    return sqrt(norm(a));
}
 
double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}
 
double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}
 
//2つの円の共通接線の数を数える関数
int calc_num(Circle A,Circle B){
 
    double c1x,c1y,c1r,c2x,c2y,c2r,dist;
 
    c1x = A.center.x;
    c1y = A.center.y;
 
    c2x = B.center.x;
    c2y = B.center.y;
 
    c1r = A.r;
    c2r = B.r;
 
    dist = sqrt((c1x-c2x)*(c1x-c2x)+(c1y-c2y)*(c1y-c2y));
 
    if(dist > c1r + c2r){
 
        return 4;
 
    }else if(fabs(dist - (c1r+c2r)) < EPS){
 
        return 3;
 
    }else{
        if(c1r > c2r){
            if(dist < c1r){
                if(fabs(c1r-(dist+c2r)) < EPS){
                    return 1;
                }else{
                    if(dist < (c1r-c2r)){
                        return 0;
                    }else{
                        return 2;
                    }
                }
 
            }else{
                return 2;
            }
 
        }else{
            if(dist < c2r){
                if(fabs(c2r-(dist+c1r)) < EPS){
                    return 1;
                }else{
                    if(dist < (c2r-c1r)){
                        return 0;
                    }else{
                        return 2;
                    }
                }
            }else{
                return 2;
            }
        }
    }
}
 
//2つの円が2点で交わるか否か
bool is_Cross(Circle A,Circle B){
 
    return calc_num(A,B) == 2;
}
 
/*
 * IN 2
 * ON 1
 * OUT 0
 *
 */
int contains(Polygon g,Point p){
    int n = g.size();
    bool x = false;
    for(int i = 0; i < n; i++){
        Point 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;
    }
    return (x ? 2:0);
}
 
double calc_dist(Point A,Point B){
 
    return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}
 
bool is_In(Circle c,Point p){
 
    return calc_dist(c.center,p)+EPS < c.r;
}
 
void func(){
 
    POLYGON.clear();
 
    for(int i = 0; i < SIZE; i++){
 
        NODES[i].clear();
    }
 
    for(int i = 0; i < num_circle; i++){
 
        scanf("%lf %lf %lf",&circle[i].center.x,&circle[i].center.y,&circle[i].r);
    }
 
    for(int i = 0; i < num_circle; i++){
 
        for(int k = 0; k < num_circle; k++){
            if(k == i || is_Cross(circle[i],circle[k]) == false)continue;
 
            Vector vec = circle[k].center-circle[i].center;
            NODES[i].push_back(Node(k,atan2(vec.y,vec.x)));
        }
        sort(NODES[i].begin(),NODES[i].end());
    }
 
    for(int i = 0; i < num_circle; i++){
        for(int k = 0; k < num_circle; k++){
            check[i][k] = false;
        }
    }
 
    for(int i = 0; i < num_circle; i++){
        for(int k = 0; k < NODES[i].size(); k++){
 
            if(check[i][NODES[i][k].circle_index])continue;
 
            int base = i,adj = NODES[i][k].circle_index;
 
            Polygon polygon;
 
            do{
 
                polygon.push_back(circle[base].center);
                check[base][adj] = true;
 
                int next;
 
                for(int a = 0;a < NODES[base].size(); a++){
 
                    if(NODES[base][a].circle_index == adj){
                        next = NODES[base][(a+1)%NODES[base].size()].circle_index;
                        break;
                    }
                }
 
                adj = base;
                base = next;
 
            }while(base != i);
 
            POLYGON.push_back(polygon);
        }
    }
 
    Point P,Q;
    queue<string> ANS;
 
    bool FLG;
 
    for(int loop = 0; loop < num_line; loop++){
 
        scanf("%lf %lf %lf %lf",&P.x,&P.y,&Q.x,&Q.y);
 
        FLG = false;
 
        int count = 0;
 
        for(int i = 0; i < num_circle; i++){
 
            if(is_In(circle[i],P) != is_In(circle[i],Q)){
 
                ANS.push("NO");
                FLG = true;
                break;
            }
            if(is_In(circle[i],P) == true && is_In(circle[i],Q) == true){
                count++;
            }
        }
 
        if(FLG)continue;
 
        if(count > 0){
            ANS.push("YES");
            FLG = true;
        }
        if(FLG)continue;
 
        for(int i = 0; i < POLYGON.size(); i++){
            if(contains(POLYGON[i],P) != contains(POLYGON[i],Q)){
 
                ANS.push("NO");
                FLG = true;
                break;
            }
        }
        if(FLG)continue;
 
        ANS.push("YES");
    }
 
    printf("%s",ANS.front().c_str());
    ANS.pop();
 
    while(!ANS.empty()){
 
        printf(" %s",ANS.front().c_str());
        ANS.pop();
    }
 
    printf("\n");
}
 
int main(){
 
    while(true){
 
        scanf("%d %d",&num_circle,&num_line);
        if(num_circle == 0 && num_line == 0)break;
 
        func();
    }
 
    return 0;
}


Measured memory_bytes: 3576