Form a Square
Time limit: 1 Seconds
Memory limit: 32768K
Have you ever put up a tent on top of a mountain? The difficulty lies in finding the appropriate positions to fix the nails on the ground, which is a mostly exposed rock where we can hardly press the nails.
In our problem we have a square tent, which means we need to fix the four vertices on the ground. For some reason the size of the tent is not very important, but we need to accurately fix the vertices to form a square. Now we have picked four spots that are suitable to press the nails and your job is to decide whether the spots form a square.
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. T test cases follow, each preceded by a single blank line.
Each test case contains 4 lines for the coordinates of the four distinct vertices that are picked. Each line contains the x and y coordinates separated by a single space (0 < x, y < 1,000). But please notice that the coordinates are not necessarily given in either clockwise or counterclockwise order for a square.
Results should be directed to standard output. Start each case with "Case #:" on a single line, where # is the case number starting from 1. Two consecutive cases should be separated by a single blank line. No blank line should be produced after the last test case.
The output should be either "Yes" or "No", indicating whether or not the four given positions can form a square.
3. Sample Input
3 1 1 1 2 2 1 2 2 1 1 2 2 3 3 4 4 1 2 2 1 2 3 3 2
4. Sample Output
Case 1: Yes Case 2: No Case 3: Yes