Bonus

All submissions for this problem are available.
Kinku is a project manager in his company. Recently, the executives decided to give bonus to everyone in his team, so Kinku was asked to give a list to them how much bonus each should get.
To do this, he selected some pairs of members, and analyzed who should get more bonus, and how more much he should get (at least). That is, if employee Tom is better than Jerry, and Tom should get at least 300 dollars more than Jerry, then, if Jerry gets 650 dollars bonus, Tom has to get atleast 950 dollars bonus. It should also be noted that, every one will get at least a minimum, no one will go empty handed.
Given all the comparisons, you have to find the minimum total bonus to be divided among the employees.
Input
 First line contains T, the number of test cases.
 Each test case starts with three integers N(1 ≤ N ≤ 100), M(0 ≤ M ≤ N*(N−1)/2) and L(1 ≤ L ≤ 10000), the number of employees, number of comparisons and minimum bonus.
 Next M lines each contains three integers, i, j(1 ≤ i, j ≤ N) and c(0 ≤ c ≤ 1000), referring that employee_{i} should get at least c dollars more than employee_{j},
Output
For each test case, output the minimum total bonus on the first line, and the bonus given to each employee in the next line.
If comparisons are inconsistent, and it’s not possible distribute bonus among them, output “Inconsistent analysis.”(without quotes).
Sample input
2 4 4 100 1 2 10 2 3 20 1 3 40 2 4 5 3 3 100 1 2 10 2 3 10 3 1 10
Sample output
460 140 120 100 100 Inconsistent analysis.
Author:  admin 
Tags  admin 
Date Added:  27102010 
Time Limit:  10 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH 3.6, GO, NODEJS, PERL6, TEXT, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 