Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

2772.   Parallelogram
Time Limit: 1.0 Seconds   Memory Limit: 65536K
Total Runs: 1129   Accepted Runs: 510

As a student of applied mathematics school of UESTC, WCM likes mathematics. Recently he is absorbed in geometry. But a very easy problem puzzled him. He can't know how to determine whether a quadrilateral is a parallelogram or not. How poor he is! He believes that you, who are regarded as one of his smartest friend, can solve this problem easily.

Given two segments, AC and BD, you should determine whether quadrilateral ABCD is a parallelogram whose diagonals are AC and BD.


The first line contains a positive integer T, which means the number of test cases. For each test case, the first line contains four integers X1,Y1,X3,Y3, (X1,Y1) is the coordinates of A and (X3,Y3) is the coordinates of C. The second line consists of four integers X2,Y2,X4,Y4, (X2,Y2) is the coordinates of B and (X4,Y4) is the coordinates of D. You can assume that points A, B, C and D are different from each other.


For each test case, if quadrilateral ABCD is a parallelogram whose diagonals are AC and BD, then output Yes on a line; otherwise, output No.


  • All the coordinates are between -1000 and 1000.
  • Sample Input

    -1 -1 3 3
    -2 0 4 2
    -1 -2 3 4
    3 7 6 9

    Sample Output


    Source: The 5th UESTC Programming Contest Warmup
    Submit   List    Runs   Forum   Statistics

    Tianjin University Online Judge v1.3.0
    Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz