Four Vertices of a Cube
InterviewTime limit1sMemory limit1024 MB
Given T test cases of four distinct indices of a unit cube's vertices, determine whether each set of four points lies on a single face of the cube.
- Level
Easy2 of 10
- Topics
- Implementation, Brute force
- Solved
- No attempts yet
Problem
Eight points in three-dimensional coordinate space, , , , , , , , and , are the vertices of a cube .
Determine whether four given vertices lie on one face of the cube .
Input
The first line contains the number of test cases .
Each of the following lines contains four distinct integers , , , and , separated by spaces. Each integer is the index of a vertex of the cube .
Output
For each test case, print one line. Print YES if , , , and are four vertices on one face of the cube . Otherwise, print NO.