def f(e1,e2,e3) a1=e1[0]-e3[0] b1=e1[1]-e3[1] a2=e2[0]-e3[0] b2=e2[1]-e3[1] return a1*b2-a2*b1 end x0,y0,z0=gets.split.map{|e| e.to_f} x1,y1,z1=gets.split.map{|e| e.to_f} x2,y2,z2=gets.split.map{|e| e.to_f} x,y,z=gets.split.map{|e| e.to_f} a1=x1-x0 a2=y1-y0 a3=z1-z0 b1=x2-x0 b2=y2-y0 b3=z2-z0 p1=a2*b3-a3*b2 q1=a3*b1-a1*b3 r1=a1*b2-a2*b1 t=(p1*(x0-x)+q1*(y0-y)+r1*(z0-z))/(p1**2+q1**2+r1**2) tx=x+t*p1 ty=y+t*q1 tz=z+t*r1 tx=tx-x0 ty=ty-y0 tz=tz-z0 x1=x1-x0 y1=y1-y0 z1=z1-z0 x2=x2-x0 y2=y2-y0 z2=z2-z0 x0=0 y0=0 z0=0 t1=0 t2=0 t3=0 if x1*y2-y1*x2!=0 #xy bad z t1=f([x0,y0],[x1,y1],[tx,ty]) t2=f([x1,y1],[x2,y2],[tx,ty]) t3=f([x2,y2],[x0,y0],[tx,ty]) elsif x1*z2-z1*x2!=0 #xz bad y t1=f([x0,z0],[x1,z1],[tx,tz]) t2=f([x1,z1],[x2,z2],[tx,tz]) t3=f([x2,z2],[x0,z0],[tx,tz]) else #yz bad x t1=f([y0,z0],[y1,z1],[ty,tz]) t2=f([y1,z1],[y2,z2],[ty,tz]) t3=f([y2,z2],[y0,z0],[ty,tz]) end if t1<0 && t2<0 && t3<0 puts "YES" elsif t1>0 && t2>0 && t3>0 puts "YES" else puts "NO" end