def intersect_segment?(p,q,r,s)
  # ----p---q---- with r---s
  ((p[0] - q[0]) * (r[1] - p[1]) + (p[1] - q[1]) * (p[0] - r[0])) * \
  ((p[0] - q[0]) * (s[1] - p[1]) + (p[1] - q[1]) * (p[0] - s[0])) <= 0
end

def intersect?(p,q,r,s)
  intersect_segment?(p,q,r,s) && intersect_segment?(r,s,p,q)
end

def inner_triangle?(p,q,r,t)
  g = [p,q,r].transpose.map{|i| i.inject(:+)}
  intersect?(p,q,g,t) || intersect?(q,r,g,t) || intersect?(r,p,g,t)
end

$<.to_a.each do |line|
  t = line.chomp.split(' ').map(&:to_f)
  p1 = t[0..1]
  p2 = t[2..3]
  p3 = t[4..5]
  target = t[6..7]

  puts inner_triangle?(p1,p2,p3,target) ? 'YES' : 'NO'
end