class P: def __init__(self,x,y,z): self.x=x self.y=y self.z=z def __str__(self): return "({}, {}, {})".format(self.x,self.y,self.z) def __repr__(self): return str(self) def __neg__(self): return P(-self.x,-self.y,-self.z) def __sub__(self,other): return P(self.x-other.x,self.y-other.y,self.z-other.z) def __mul__(self,other): return self.x*other.x+self.y*other.y+self.z*other.z #================================================ A=P(*tuple(map(int,input().split()))) B=P(*tuple(map(int,input().split()))) C=P(*tuple(map(int,input().split()))) D=P(*tuple(map(int,input().split()))) p=B-A;q=C-A a=p*p;b=c=p*q;d=q*q s=(D-A)*p;t=(D-A)*q det=a*d-b*c alpha=(d*s-b*t)/det beta =(-c*s+a*t)/det print("YES" if 0<=alpha<=1 and 0<=beta<=1 and 0<=alpha+beta<=1 else "NO")