def z a,b,c,d
a*d-b*c>0
end
def x a,b,c,d,e,f,s,t
z(a-c,b-d,a-s,b-t)==(k=z c-e,d-f,c-s,d-t)&&k==z(e-a,f-b,e-s,f-t)
end
gets.to_i.times{*a,g,h,i,j=gets.split.map &:to_i
puts x(*a,g,h)^x(*a,i,j)?:OK:"NG"}