#include<cstdio>
#include<cmath>
const double eps=1e-9;
bool zero(double e)
{return fabs(e)<eps;}
int sgn(double e)
{return e<-eps?-1:e>eps;}
struct v3{
    double x,y,z;
    v3(){}
    v3(double x,double y,double z):x(x),y(y),z(z){}
    void s()
    {
        scanf("%lf%lf%lf",&x,&y,&z);
    }
    void p()
    {
      //  printf("%lf %lf %lf",x,y,z);
    }
    double len()
    {
        return sqrt(x*x+y*y+z*z);
    }
    v3 normalized()
    {
        double l=this->len();
        return v3(x/l,y/l,z/l);
    }
};
v3 operator +(v3 a,v3 b){return v3(a.x+b.x,a.y+b.y,a.z+b.z);}
v3 operator -(v3 a,v3 b){return v3(a.x-b.x,a.y-b.y,a.z-b.z);}
v3 operator *(v3 a,double b){return v3(a.x*b,a.y*b,a.z*b);}
v3 operator /(v3 a,double b){return v3(a.x/b,a.y/b,a.z/b);}
v3 operator *(double b,v3 a){return v3(a.x*b,a.y*b,a.z*b);}
v3 Det(v3 a,v3 b)
{
    return v3(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}
double Dot(v3 a,v3 b)
{
    return a.x*b.x+a.y*b.y+a.z*b.z;
}

struct l3
{
v3 a,b;
l3(){};
l3(v3 a,v3 b):a(a),b(b){};
};
struct p3
{
v3 a,b,c;
p3(){}
p3(v3 a,v3 b,v3 c):a(a),b(b),c(c){}
};
double vlen(v3 p){return sqrt(Dot(p,p));}
v3 pvec(v3 s1,v3 s2,v3 s3)
{
    return Det(s1-s2,s2-s3);
}
v3 pvec(p3 x)
{return pvec(x.a,x.b,x.c);}
int parallel(p3 u,p3 v)
{
    return vlen(Det(pvec(u),pvec(v)))<eps;

}
int parallel(v3 a,v3 b,p3 s)
{
    return zero(Dot(a-b,pvec(s)));
}
v3 intersection(v3 a,v3 b,p3 s)
{
    v3 ret=pvec(s);
    double t=(ret.x*(s.a.x-a.x)+ret.y*(s.a.y-a.y)+ret.z*(s.a.z-a.z))/
            (ret.x*(b.x-a.x)+ret.y*(b.y-a.y)+ret.z*(b.z-a.z));
    ret=a+(b-a)*t;
    return ret;

}
bool intersection(p3 pl1,p3 pl2,l3& li)
{
    if(parallel(pl1,pl2))return false;
    li.a=parallel(pl2.a,pl2.b,pl1)?intersection(pl2.b,pl2.c,p3(pl1.a,pl1.b,pl1.c)):
    intersection(pl2.a,pl2.b,p3(pl1.a,pl1.b,pl1.c));
    v3 fa;
    fa=Det(pvec(pl1),pvec(pl2));
    li.b=li.a+fa;
    return true;
}
double ptoplane(v3 p,p3 s)
{
    return fabs(Dot(pvec(s),p-s.a))/vlen(pvec(s));
}
double ptoline(v3 p,l3 l)
{
    return vlen(Det(p-l.a,l.b-l.a))/(l.a-l.b).len();
}
int main()
{
    v3 c1;
    c1.s();
    v3 d1,d2;
    d1.s();
    d2.s();
    p3 p1=p3(c1,c1+d1,c1+d2);


    v3 c2;
    c2.s();
    v3 d1p,d2p;
    d1p.s();
    d2p.s();
    p3 p2=p3(c2,c2+d1p,c2+d2p);

    l3 ins;
    //not parl//
    if(!intersection(p1,p2,ins)){puts("NO");return 0;}

    v3 l=(ins.b-ins.a).normalized();
    double r1=ptoline(c1,ins),r2=ptoline(c2,ins);
    if(r1>1+eps||r2>1+eps){puts("NO");return 0;}

    double le1=sqrt(1-r1*r1);

    //projection//
    v3 pt1;
    if(zero(ptoline(c1,ins)))
        pt1=c1;
    else{
        v3 p01=Det(c1-ins.a,c1-ins.b);
        v3 p02=Det(ins.b-ins.a,p01);
        p3 p0=p3(c1,c1+p01,c1+p02);
        pt1=intersection(ins.a,ins.b,p0);
    }


    v3 np1=pt1+l*le1,np2=pt1-l*le1;
    //ins.b.p();
    //np2.p();
    if(sgn(vlen(np1-c2)-1.0)*sgn(vlen(np2-c2)-1.0)!=-1){puts("NO");return 0;}
    puts("YES");
    return 0;




}