def scan; gets.split.map{|e|Rational(e)};end # ๐ŸŽ def kadomatu?(a,b,c) a!=b&&b!=c&&c!=a&&((ac)||(a>b&&bx2&&x2>x3&&y1>y2&&y2>y3 # ไบŒๅˆ†ๆŽข็ดขใ™ใ‚‹๏ผŽ # tL = 0 , tH = (ๅคงใใชๆ•ฐๅ€ค)ใ‹ใ‚‰้–‹ๅง‹ใ™ใ‚‹๏ผŽ # tLใฎใจใใซ็ซนใฎ้•ทใ•ใŒๆ˜‡้ †ใ ใฃใŸใจใ™ใ‚‹ใจ๏ผŒtHใฏ้™้ †ใซใชใฃใฆใ„ใ‚‹ใฏใšใงใ‚ใ‚‹๏ผŽ # ใฉใ“ใ‹ใงๆ˜‡้ †ใจ้™้ †ใŒๅˆ‡ใ‚Šๆ›ฟใ‚ใฃใฆใ„ใ‚‹ใฏใšใชใฎใง๏ผŒใใฎๆ™‚ๅˆปใ‚’ๆŽขใ—๏ผŒ๐ŸŽใซใชใฃใฆใ„ใ‚‹ใ‹ใฉใ†ใ‹ๆคœ่จผใ™ใ‚‹๏ผŽ tl = Rational(0) th = Rational(1e15) 80.times{ tc = (tl+th)/2 if kadomatu?(x1+y1*tc, x2+y2*tc, x3+y3*tc) STDERR.puts "found #{tc.to_f}" return "YES" end # ๆ™‚ๅˆป0ใฎใ€Žๆ˜‡้ †/้™้ †ใ€ใจๆ™‚ๅˆปtcใฎใ€Žๆ˜‡้ †/้™้ †ใ€ใŒ็ญ‰ใ—ใ„ใชใ‚‰ if (x1 < x3) == (x1+y1*tc < x3+y3*tc) tl = tc else th = tc end } STDERR.puts "#{tl.to_f} < t < #{th.to_f}" return "NO" end n=gets.to_i n.times{ x1,x2,x3,y1,y2,y3 = scan puts solve2(x1,x2,x3,y1,y2,y3) } exit