spoj#IITWPC4C. Maggu and Vectors
Maggu and Vectors
Maggu was teaching vectors using triangle diagrams to to his little brother. Now in the midst of lesson he went for a coffee and on returning finds all his triangles disassembled into constituent vectors by his naughty brother. He needs to recreate the triangles. He needs your help in doing this task quickly as he has to go for an internship interview.
Input
First line will contain T (1 <= T <= 10), the number of test cases. Each test case will consist of first line N, number of vectors. Next line will contain N (1 <= N <= 1000) vectors of the form of a b -1000<=a,b<=1000.
Output
You have to print, in a new line for every test case, “YES” if any 3 vectors among N form a triangle, “NO” otherwise.
Example
Input:3 5
3 4 3 -4 5 0 6 0 3 5
2
4 5 -4 -5
3
1 2 3 4 -5 -6
Output:YES
NO NO