final-attack
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

To plan for Final Day attack on the city of Lanka Sugreev decided to steal the map of the city from the Central Library of Lanka. As Ravan is quiet smart, he has made lot of fake maps and kept them with the real map. Sugreev's spy attacked the library and bought all the maps.

Each of the map is given in the form of Directed Weighted Graph. Each node on the graph denotes a guard post in the city. Let edge weight from node 'i' to node 'j' be denoted by w[i]. If there is an edge from node 'i' to node 'j' then it means that guard post at node i requires at least w[i] more soldiers to break than guard post
 at node j. 

Now it is Sugreev's job to decide which of the maps is a real one and which is the fake one. Sugreev has asked you to help him.
You will be provided a description of map and if map is valid one then print "YES" otherwise print "NO" (quotes for clarity).

Input:

First line will contain T, denoting the number of test cases.

Each test case will contain following:

First line will contain N. number of nodes.

Next line contain M, number of edges

Next M lines will follow.

Each line will contain three integers i, j, w[i], denoting an edge from node i to j having weight w[i] respectively.

Output:

For each Test Case

A single line consisting of the output.

Constraint:

0 < T ≤ 10

0 < N ≤ 100 (10^2)

0 ≤ M ≤ (N*(N-1))

0 < i ≤ N

0 < j ≤ N

0 ≤ w[i] ≤ 100000 (10^5)

Note: No self loop occur in the graph.

SAMPLE INPUT
2

5
4
1 2 3
2 3 3
3 4 6
4 5 5

4
4
1 2 2
2 3 3
3 4 5
4 1 6

SAMPLE OUTPUT
YES
NO

Explanation

        2    
(1) - - - - ->(2)
/|\            |
 |             |
 |             | 3
6|             |
 |             |
 |            \|/ 
(4) <---------(3)
        5

Answer: NO