Time limit
2s
Memory limit
128 MB
A 4 by 4 matrix gives the distances between four points. Determine whether four distinct points can be placed in three-dimensional Euclidean space so that all of the given distances hold at the same time.
The input consists of 4 lines. Each line contains 4 integers. The j-th integer on the i-th line is the distance between point i and point j.
The i-th integer on the i-th line is always 0, and the j-th integer on the i-th line equals the i-th integer on the j-th line. When i and j are different, the value is a positive integer no greater than 10.
Print YES if the given distances can describe four points, and print NO otherwise.
If every pairwise distance is 1, the four points can be placed at the vertices of a regular tetrahedron.