#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long LL;
const double EPS=1e-8;
struct Point3D {
	double x, y, z;
};

struct Line3D {
	Point3D a, b;
};

struct Plane {
	Point3D a, b, c;
};

inline bool zero(const LL x) {
	return (x>0?x:-x)<EPS;
}

inline Point3D xmult(const Point3D &u, const Point3D &v) {
	Point3D ret;
	ret.x = u.y * v.z - v.y * u.z;
	ret.y = u.z * v.x - u.x * v.z;
	ret.z = u.x * v.y - u.y * v.x;
	return ret;
}

inline LL dmult(const Point3D &u, const Point3D &v) {
	return u.x * v.x + u.y * v.y + u.z * v.z;
}

inline Point3D subt(const Point3D &u, const Point3D &v) {
	Point3D ret;
	ret.x = u.x - v.x;
	ret.y = u.y - v.y;
	ret.z = u.z - v.z;
	return ret;
}

inline double dis(const Point3D & p1, const Point3D & p2){
	return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z));
}

inline double vlen(const Point3D & p){
	return sqrt(p.x*p.x+p.y*p.y+p.z*p.z);
}

inline double sqrlen(const Point3D &p){
	return (p.x*p.x+p.y*p.y+p.z*p.z);
}

bool dotOnlineIn(const Point3D &p, const Line3D &l) {
	return zero(sqrlen(xmult(subt(p, l.a), subt(p, l.b)))) && 
		   (l.a.x - p.x) * (l.b.x - p.x) < 0 &&
		   (l.a.y - p.y) * (l.b.y - p.y) < 0 &&
		   (l.a.z - p.z) * (l.b.z - p.z) < 0;
}

bool dotOnlineEx(const Point3D &p, const Line3D &l) {
	return dotOnlineIn(p, l) && (
			!zero(p.x - l.a.x) ||
			!zero(p.y - l.a.y) ||
			!zero(p.z - l.a.z) ||
			!zero(p.x - l.b.x) ||
			!zero(p.y - l.b.y) ||
			!zero(p.z - l.b.z)
		);
}

bool dotInplaneIn(const Point3D &p, const Plane &s) {
	return zero(vlen(xmult(subt(s.a, s.b), subt(s.a, s.c))) - 
			vlen(xmult(subt(p, s.a), subt(p, s.b))) - 
			vlen(xmult(subt(p, s.b), subt(p, s.c))) - 
			vlen(xmult(subt(p, s.c), subt(p, s.a)))
		);
}

bool dotInplaneEx(const Point3D &p, const Plane &s) {
	return dotInplaneIn(p, s) &&
		   sqrlen(xmult(subt(p, s.a), subt(p, s.b)))>EPS &&
		   sqrlen(xmult(subt(p,s.b),subt(p, s.c)))> EPS && sqrlen(xmult(subt(p,s.c),subt(p, s.a)))>EPS;
}

struct node {
	int x, y, z;	
	node() {}
	node(int x, int y, int z):x(x), y(y), z(z) {}
	bool input() {
		return 3 == scanf("%d %d %d", &x, &y, &z);
	}
	bool equ(const node &a) {
		return x * a.y == y * a.x && x * a.z == z * a.x;
	}
} p[3], tt;

vector <node> q;

inline bool input() {
	for (int i=0; i<3; ++i) {
		if (!p[i].input()) return false;
	}
	tt.input();
	return true;
}

bool gao3() {
	Plane t;
	Point3D pp;
	
	t.a.x = q[0].x, t.a.y = q[0].y, t.a.z = q[0].z;
	t.b.x = q[1].x, t.b.y = q[1].y, t.b.z = q[1].z;
	t.c.x = q[2].x, t.c.y = q[2].y, t.c.z = q[2].z;

	pp.x = tt.x, pp.y = tt.y, pp.z = tt.z;

	return dotInplaneIn(pp, t);
}

bool gao2() {
	Line3D l;
	Point3D pp;

	l.a.x = q[0].x, l.a.y = q[0].y, l.a.z = q[0].z;
	l.b.x = q[1].x, l.b.y = q[1].y, l.b.z = q[1].z;

	pp.x = tt.x, pp.y = tt.y, pp.z = tt.z;

	return dotOnlineEx(pp, l);
}

bool gao1() {
	int i, j, k;

	if (!q[0].equ(tt)) return false;
	vector <int> t;
	for (i=0; i<3; ++i) t.push_back(p[0].x);
	sort(t.begin(), t.end());
	return t[0] < tt.x && tt.x < t[2];
}

bool gao() {
	int i, j, k;
	
	q.clear();
	q.push_back(p[0]);
	for (i=1; i<3; ++i) {
		for (j=0; j<q.size(); ++j) if (p[i].equ(q[j])) break;
		if (j == q.size()) q.push_back(p[i]);
		else printf("%d %d\n", j, q.size());
	}

	printf("%d\n", q.size());
	if (q.size() == 3) return gao3();
	else if (q.size() == 2) return gao2();
	else if (q.size() == 1) return gao1();
	else throw "gao() error !";
}

int main() {
	int i, j, k;

	while (input()) puts(gao()?"YES":"NO");

	return 0;
}
