
N = 4
M = 3
A = [ [ 0, 2, 1 ] , [ 1, 2, 4 ] , [ 2, 3, 3 ] ]
If Ninja chooses [ 0, 2, 1 ] and [ 2, 3, 3 ], he can taste each dish for 4 Ninja Currency.
The first line contains an integer 'T', denoting the number of test cases.
Then the test cases follow:
The first line of each test case contains two space-separated integers, 'N' and 'M', denoting the total number of dishes and the total number of different orders.
The following ‘M’ line contains three integers ‘Li’, ‘Ri’ and ‘Ci’, denoting Starting point of food, End Point of food and Cost of ordering from ‘Li’ to ‘Ri’.
Print an integer denoting the minimum Ninja Currency required to taste all dishes for each test case.
Print the output of each test case in a new line.
You are not required to print the expected output. It has already been taken care of. Just implement the function.
1 <= 'T' <= 10
1 <= 'N' <= 10^5
1 <= 'M' <= 10^5
0 <= 'L[i]' <= ‘R[i]’ <= ‘N-1’
1 <= ‘C[i]’ <= 10^4
Sum of 'N' overall test cases doesn’t exceed 10^5.
Time Limit: 1 sec