Under construction

Still being built. Things may change

Making a Tetrahedron

Time limit1sMemory limit128 MB

Summary
For each of up to 10000 sets of six edge lengths, decide whether some assignment to a tetrahedron gives non-zero volume.
Level

Medium7 of 10

Topics
Geometry, Sorting, Brute force, Math
Solved
No attempts yet

Problem

It is well known that you cannot make a triangle with non-zero area whose sides have lengths 1, 2, and 3. Can you make a tetrahedron with non-zero volume whose six edges have lengths 1, 2, 3, 4, 5, and 6?

You may assign the six given lengths to the six edges of the tetrahedron in any arrangement. The answer is affirmative if some arrangement yields a tetrahedron with strictly positive volume.

Input

The first line contains an integer nn, the number of lines that follow (0<n≤100000 < n \le 10000).

Each of the next nn lines contains six space-separated positive integers, the lengths of the edges of the desired tetrahedron. Each edge length is at most 10610^6.

Output

Output nn lines. For each query, print YES if it is possible to construct a tetrahedron with non-zero volume from the six given edge lengths, or NO if it is not possible.

Examples2

  1. Example 1

    Input
    1
    1 2 3 4 5 6
    
    Expected output
    NO
    
  2. Example 2

    Input
    1
    1 1 1 1 1 1
    
    Expected output
    YES