Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

Python: import sys
f = sys.stdin

def take2(iterable):
    i = iter(iterable)
    while True:
        yield next(i) + next(i) * 1j
    

n = int(f.readline())
for _ in range(n):
    a, b, c, d = [xiyi for xiyi in take2(map(float, f.readline().split()))]
    ab, cd = a - b, c - d
    if abs((ab * cd).real) < 0.00001:
        print('YES')
    else:
        print('NO')

Python: n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
    if (y2-y1)/(x2-x1)==(y4-y3)/(x4-x3):
        print("YES")
    else:
        print("NO")

Python: import sys
cases = int(input())
i = 0
while i <= cases:
   #for line in sys.stdin.readlines():
   x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 = map(float,input().split())
   dy1 = y2 - y1
   dy2 = y4 - y3
   dx1 = x2 - x1
   dx2 = x4 - x3
   k=round(dy1*dx2,5)
   l=round(dy2*dx1,5)
   if(k==l):
       print("YES")
   else:
       print("NO")
   i += 1

Python: n = int(input())
for i in range(n):
  x1, y1, x2, y2, x3, y3, x4, y4 = [float(j) for j in input().split()]
  if x2 - x1 == 0:
    if x4 - x3 == 0:
      print("YES")
    else:
      print("NO")
  print("YES" if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) else "NO")

Python: n = int(input())
for i in range(n):
  x1, y1, x2, y2, x3, y3, x4, y4 = [float(j) * 10**10 for j in input().split()]
  if x2 == x1:
    if x4 == x3:
      print("YES")
    else:
      print("NO")
  elif x4 == x3:
    print("NO")
  else:
    print("YES" if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) else "NO")

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-


import collections
import math


LIMIT = 1e-10


class Vector2(collections.namedtuple("Vector2", "x y")):

    __slots__ = ()

    def __add__(self, other):
        return Vector2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Vector2(self.x - other.x, self.y - other.y)

    def __mul__(self, other):
        return self.x * other.y - self.y * other.x

    def __neg__(self):
        return Vector2(-self.x, -self.y)

    def __pos__(self):
        return Vector2(+self.x, +self.y)

    def __abs__(self):
        return math.sqrt(float(self.x * self.x + self.y * self.y))

    def dotproduct(self, other):
        return self.x * other.x + self.y * other.y


def main():
    n = int(input())
    for i in range(n):
        [x1, y1, x2, y2, x3, y3, x4, y4] = [float(z) for z in input().split()]
        vector_ab = Vector2(x2 - x1, y2 - y1)
        vector_cd = Vector2(x4 - x3, y4 - y3)
        if abs(vector_ab * vector_cd) < LIMIT:
            print("YES")
        else:
            print("NO")


if __name__ == "__main__":
    main()

Python: from fractions import Fraction

def sroap(x1,y1,x2,y2):
	if x2 - x1 == 0:
		return float("inf")
	else:
		return Fraction(y2 - y1,x2 - x1)
		
N = int(input())
for n in range(N):
	Ax,Ay,Bx,By,Cx,Cy,Dx,Dy = map(lambda x: round(x * 10 ** 5),(map(float,input().split())))
	if sroap(Ax,Ay,Bx,By) == sroap(Cx,Cy,Dx,Dy):
		if sroap(Ax,Ay,Bx,By) == sroap(Bx,By,Cx,Cy):
			print("NO")
		else:
			print("YES")
	else:
		print("NO")

Python: n=int(input())
for nn in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4=list(map(float,input().split()))
    if x2-x1==0 or x4-x3==0:
        if x1==x2 and x3==x4:
            print("YES")
        else:
            print("NO")
    else:
        if abs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<10**-10:
            print("YES")
        else:
            print("NO")

Python: for _ in range(int(input())):
    ax, ay, bx, by, cx, cy, dx, dy = map(float, input().split())
    print(['NO','YES'][(ay-by)*(dx-cx)-(ax-bx)*(dy-cy)<1e-10])

Python: n = int(input())
for i in range(n):
  try:
    x1, y1, x2, y2, x3, y3, x4, y4 = [float(j) for j in input().split()]
    if x2 - x1 == 0.0:
      if x4 - x3 == 0.0:
        print("YES")
      else:
        print("NO")
    elif x4 - x3 == 0.0:
      print("NO")
    print("YES" if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) else "NO")
  except:
    break

Python: import sys
n = input()
for line in sys.stdin.readlines():
  l = [float(i) for i in line.split()]
  if (l[2]-l[0])*(l[7]-l[5]) == (l[3]-l[1])*(l[6]-l[4]):
    print('YES')
  else:
    print('NO')

Python: N = int(input())
for i in range(N):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    x2 -= x1; y2 -= y1
    x4 -= x3; y4 -= y3
    print("YES" if abs(x2*y4 - x4*y2) < 1e-10 else "NO")

Python: import sys
import math

n = int(input())
for s in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float, input().strip().split())
    angle1 = abs(y2-y1)/abs(x2-x1)
    angle2 = abs(y4-y3)/abs(x4-x3)
    if angle1 == angle2:
        print("YES")
    else:
        print("NO")

Python: def main():
    n = int(input())
    for i in range(n):
        x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split())
        if x1 == x2 and x3 == x4 :
            print("YES")
        elif x1 == x2 or x3 == x4 :
            print("NO")
        elif (y2-y1)/(x2-x1) == (y4 - y3)/(x4 -x3):
            print("YES")
        else:
            print("NO")

if __name__ == '__main__':
    main()

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if x1 == x2 and x3 == x4:
        print("YES")
    elif (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3):
        print("YES")
    else:
        print("NO")

Python: n = int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float, input().split())
    if x1-x2 == 0 or x3-x4 ==0:
        if x1-x2 == 0 and x3-x4 ==0:
            print('YES')
        else:
            print('NO')
    elif (y1-y2)/(x1-x2) == (y3-y4)/(x3-x4):
        print('YES')
    else:
        print('NO')

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    print('YES' if (x2 - x1)*(y4 - y3) == (x4 - x3)*(y2 - y1) else 'NO')

Python: # ????????????????????°??????
import sys

def is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
    d1x = x2 - x1
    d1y = y2 - y1
    d2x = x4 - x3
    d2y = y4 - y3

    if d1x != 0 and d2x != 0:
        a1 = d1y / d1x
        a2 = d2y / d2y
        return a1 == a2

    if d1x == 0 and d2x == 0:
        return True

    return False

def main():
    n = int(sys.stdin.readline().strip())

    for _ in range(n):
        data = sys.stdin.readline().strip().split(' ')
        x1 = float(data[0])
        y1 = float(data[1])
        x2 = float(data[2])
        y2 = float(data[3])
        x3 = float(data[4])
        y3 = float(data[5])
        x4 = float(data[6])
        y4 = float(data[7])

        if is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
            print('YES')
        else:
            print('NO')
            
if __name__ == '__main__':
    main()

Python: for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")