#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class Aircraft { public:
double f(const double p[], const double v[], double t)
{
return sqrt( (p[0]+t*v[0])*(p[0]+t*v[0]) + (p[1]+t*v[1])*(p[1]+t*v[1]) + (p[2]+t*v[2])*(p[2]+t*v[2]) );
}
string nearMiss(vector <int> p1, vector <int> v1, vector <int> p2, vector <int> v2, int R)
{
const double p[] = {p1[0]-p2[0], p1[1]-p2[1], p1[2]-p2[2]};
const double v[] = {v1[0]-v2[0], v1[1]-v2[1], v1[2]-v2[2]};
double x = 0.0;
double w = 1e+10;
for(int k=0; k<1000000; ++k)
{
double y = 2*x/3 + w/3;
double z = x/3 + 2*w/3;
double fx = f(p,v,x);
double fy = f(p,v,y);
double fz = f(p,v,z);
double fw = f(p,v,w);
if( fx < fy )
w = y;
else if( fz > fw )
x = z;
else if( fy < fz )
w = z;
else
x = y;
}
return f(p,v,x)-0.000001<=R ? "YES" : "NO";
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
bool ok = (Expected == Received);
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, Aircraft().nearMiss(p1, v1, p2, v2, R));}
int main(){
CASE(0)
int p1_[] = {15,50,5};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {25,1,0};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {161,102,9};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {-10,-10,-1};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 10;
string _ = "YES";
END
CASE(1)
int p1_[] = {0,0,0};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {2,2,0};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {9,0,5};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {-2,2,0};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 5;
string _ = "YES";
END
CASE(2)
int p1_[] = {0,0,0};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {-2,2,0};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {9,0,5};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {2,2,0};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 5;
string _ = "NO";
END
CASE(3)
int p1_[] = {-2838,-7940,-2936};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {1,1,-2};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {532,3850,9590};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {1,0,-3};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 3410;
string _ = "YES";
END
CASE(4)
int p1_[] = {-8509,9560,345};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {-89,-33,62};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {-5185,-1417,2846};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {-58,24,26};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 8344;
string _ = "YES";
END
CASE(5)
int p1_[] = {-7163,-371,-2459};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {-59,-41,-14};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {-2398,-426,-5487};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {-43,27,67};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 5410;
string _ = "NO";
END
CASE(6)
int p1_[] = {1774,-4491,7810};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {-12,19,-24};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {2322,3793,9897};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {-12,19,-24};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 10000;
string _ = "YES";
END
CASE(7)
int p1_[] = {3731,8537,5661};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {-70,71,32};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {8701,-1886,-5115};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {28,-13,7};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 9766;
string _ = "NO";
END
CASE(8)
int p1_[] = {0,0,0};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {0,0,0};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {1,0,0};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {0,0,0};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 1;
string _ = "YES";
END
CASE(9)
int p1_[] = {0,0,0};
vector <int> p1(p1_, p1_+sizeof(p1_)/sizeof(*p1_));
int v1_[] = {0,0,0};
vector <int> v1(v1_, v1_+sizeof(v1_)/sizeof(*v1_));
int p2_[] = {2,0,0};
vector <int> p2(p2_, p2_+sizeof(p2_)/sizeof(*p2_));
int v2_[] = {0,0,0};
vector <int> v2(v2_, v2_+sizeof(v2_)/sizeof(*v2_));
int R = 1;
string _ = "NO";
END
}
// END CUT HERE