require 'matrix'

include Math

vs = []
2.times {
	vs << Vector[*gets.split.map(&:to_f)]
	vs += gets.split.map(&:to_f).each_slice(3).map{|a| Vector[*a]}
}

d = vs[0].dup
vs[0] -= d
vs[3] -= d

if vs[1][2] != 1
	cos = vs[1].inner_product(Vector[1, 0, 0]) / sqrt(vs[1][0]**2 + vs[1][1]**2)
	sign = (vs[1][1] > 0 ? -1 : 1)
	mat = Matrix[[cos, -sign * sqrt(1-cos**2), 0], [sign * sqrt(1-cos**2), cos, 0], [0, 0, 1]]
	vs.map!{|v| mat * v}
end

cos = vs[1].inner_product(Vector[1, 0, 0]) / sqrt(vs[1][0]**2 + vs[1][2]**2)
sign = (vs[1][2] > 0 ? -1 : 1)
mat = Matrix[[cos, 0, -sign * sqrt(1-cos**2)], [0, 1, 0], [sign * sqrt(1-cos**2), 0, cos]]
vs.map!{|v| mat * v}

cos = vs[2].inner_product(Vector[0, 1, 0]) / sqrt(vs[2][1]**2 + vs[2][2]**2)
sign = (vs[2][2] > 0 ? -1 : 1)
mat = Matrix[[1, 0, 0], [0, cos, -sign * sqrt(1-cos**2)], [0, sign * sqrt(1-cos**2), cos]]
vs.map!{|v| mat * v}

vs = vs[3..5]
v1, v2 = vs[1] - vs[0], vs[2] - vs[0]
n = Vector[v1[1]*v2[2]-v1[2]*v2[1], v1[2]*v2[0]-v1[0]*v2[2], v1[0]*v2[1]-v1[1]*v2[0]]

if n[1] == 0
	if n[0] == 0
		puts 'NO'
	else
		x = n.inner_product(vs[0]) / n[0]
		v1 = Vector[x, -sqrt(1-x*x), 0]
		v2 = Vector[x, sqrt(1-x*x), 0]
		if (v1-vs[0]).r <= 1 || (v2-vs[0]).r <= 1
			puts 'YES'
		else
			puts 'NO'
		end
	end
else
	s = n.inner_product(vs[0]) / n[1]
	t = n[0] / n[1]

	a = t*t+1
	b = s*t
	c = s*s-1
	if b*b-a*c > 0
		x1 = (b + sqrt(b*b-a*c)) / a
		x2 = (b - sqrt(b*b-a*c)) / a
		v1 = Vector[x1, s-t*x1, 0]
		v2 = Vector[x2, s-t*x2, 0]
		if ((v1-vs[0]).r < 1) ^ ((v2-vs[0]).r < 1)
			puts 'YES'
		else
			puts 'NO'
		end
	else
		puts 'NO'
	end
end