In the city of contests, Yaman managed a popular storage facility called "Secure Storages" with a range of lockers numbered from $$$1$$$ to $$$n$$$. Contestants relied on Secure Storages to securely store their belongings.
One day, Yaman received $$$q$$$ requests from individuals, each with an ID from $$$1$$$ to $$$m$$$. These requests specified the desired locker number and a time interval for rental.
In other words, Yaman received $$$q$$$ requests, and each request contains three numbers $$$x, l, r$$$, which means that the locker $$$x$$$ will be rented at the time $$$[l, r]$$$.
Yaman faced the challenge of assigning lockers without any intersections or conflicts and was determined to provide excellent service. Yaman carefully reviewed the requests. He aimed to delete at most one request, allowing for a seamless locker assignment process. Yaman's goal was to ensure that no locker was shared by multiple requests at the same time.
Help Yaman determine if he can achieve his goal.
The first line contains the number of test cases $$$t$$$ $$$( 1 \le t \le 10^{3} )$$$. A description of the test cases follows.
The first line of each test case contains two integers $$$n, q$$$ $$$( 1 \le n, q \le 10^{3} )$$$, — the number of lockers, and the number of requests, respectively.
Each of the next $$$q$$$ lines contains three integers $$$x_i, l_i, r_i$$$ $$$( 1 \le x_i \le n), (1 \le l \le r \le 10^{3})$$$ — the representation of the $$$i$$$-th request.
It is guaranteed that the sum of $$$q$$$ and the sum of $$$n$$$ over all test cases does not exceed $$$10^{3}$$$.
For each test case, print "YES" (without quotes) if Yaman can achieve his goal; otherwise, you have to print "NO" (without quotes).
23 51 1 52 1 22 2 33 1 52 4 52 51 1 52 1 22 2 32 1 52 4 5
YES NO