let read_lines ?(ch=stdin) () =
  let rec read_lines acc =
    match input_line ch with
    | s -> read_lines (s :: acc)
    | exception _ -> List.rev acc in
  read_lines []

module type ArithmeticType =
  sig
    type t
    val zero : t
    val unit : t
    val ( ~- ) : t -> t
    val ( + ) : t -> t -> t
    val ( - ) : t -> t -> t
    val ( * ) : t -> t -> t
    val ( / ) : t -> t -> t
    val sqrt : t -> t
  end

module Vector2D =
  struct
    module type S =
      sig
        type scalar
        type t

        module O :
        sig
          val ( ~- ) : t -> t
          val ( + ) : t -> t -> t
          val ( - ) : t -> t -> t
          val ( * ) : scalar -> t -> t
        end

        val zero : t
        val x_unit : t
        val y_unit : t
        val of_scalars : scalar -> scalar -> t
        val to_tuple : t -> scalar * scalar
        val inner_product : t -> t -> scalar
        val norm : t -> scalar
        val x : t -> scalar
        val y : t -> scalar
      end

    module Make(Arith : ArithmeticType) :
    S with type scalar = Arith.t =
      struct
        type scalar = Arith.t
        type t = scalar * scalar

        module O =
          struct
            let ( ~- ) (x, y) =
              let open Arith in (~-x, ~-y)

            let ( + ) (vx, vy) (ux, uy) =
              let open Arith in (vx + ux, vy + uy)

            let ( - ) v u = v + ~-u

            let ( * ) s (x, y) =
              let open Arith in (s * x, s * y)
          end

        let zero = (Arith.zero, Arith.zero)

        let x_unit = (Arith.unit, Arith.zero)

        let y_unit = (Arith.zero, Arith.unit)

        let of_scalars x y = (x, y)

        let to_tuple t = t

        let inner_product (vx, vy) (ux, uy) =
          let open Arith in vx * ux + vy * uy

        let norm v =
          let open Arith in inner_product v v |> sqrt

        let x (x, _) = x

        let y (_, y) = y
      end
  end

module FloatArithmetic =
  struct
    type t = float
    let zero = 0.
    let unit = 1.
    let ( ~- ) = ( ~-. )
    let ( + ) = ( +. )
    let ( - ) = ( -. )
    let ( * ) = ( *. )
    let ( / ) = ( /. )
    let sqrt = sqrt
  end

module FVec2 = Vector2D.Make(FloatArithmetic)

let () =
  let inputs = read_lines () |> List.tl in
  let close_enough a b = abs_float (a -. b) < 0.00001 in
  List.iter
    (fun line ->
     Scanf.sscanf
       line "%f %f %f %f %f %f %f %f"
       (fun x1 y1 x2 y2 x3 y3 x4 y4 ->
        let va = FVec2.of_scalars x1 y1 in
        let vb = FVec2.of_scalars x2 y2 in
        let vc = FVec2.of_scalars x3 y3 in
        let vd = FVec2.of_scalars x4 y4 in
        let open FVec2.O in
        let ab = va - vb in
        let cd = vc - vd in
        let inner_prod = FVec2.inner_product ab cd |> abs_float in
        let norm_prod = (FVec2.norm ab) *. (FVec2.norm cd) in
        print_endline
        @@ if close_enough inner_prod norm_prod then "YES" else "NO"))

    inputs